mirror of
https://github.com/NousResearch/atropos.git
synced 2026-04-27 17:23:08 +00:00
Merge branch 'main' into 2025-05-03-http-error-logging
This commit is contained in:
commit
a659217afe
38 changed files with 1093 additions and 475 deletions
|
|
@ -156,24 +156,41 @@ def get_double_dash_flags() -> Dict[str, Any]:
|
|||
|
||||
# Remove '--' prefix
|
||||
key_part = arg[2:]
|
||||
key = ""
|
||||
value_str = (
|
||||
None # Variable to hold the string value before potential conversion
|
||||
)
|
||||
|
||||
# Check for '--key=value' format
|
||||
if "=" in key_part:
|
||||
key, value = key_part.split("=", 1)
|
||||
if key: # Ensure key is not empty (e.g. --=value)
|
||||
flags_dict[key] = value
|
||||
key, value_str = key_part.split("=", 1)
|
||||
if not key: # Ensure key is not empty (e.g. --=value)
|
||||
i += 1
|
||||
continue # Skip if key is empty
|
||||
|
||||
# Process value: Convert "None" string to None object
|
||||
if value_str == "None":
|
||||
flags_dict[key] = None
|
||||
else:
|
||||
flags_dict[key] = value_str
|
||||
i += 1
|
||||
# Check if next argument exists and is a value (doesn't start with '-')
|
||||
elif i + 1 < len(args) and not args[i + 1].startswith("-"):
|
||||
key = key_part
|
||||
value = args[i + 1]
|
||||
flags_dict[key] = value
|
||||
value_str = args[i + 1]
|
||||
|
||||
# Process value: Convert "None" string to None object
|
||||
if value_str == "None":
|
||||
flags_dict[key] = None
|
||||
else:
|
||||
flags_dict[key] = value_str
|
||||
# Skip the next argument since we've consumed it as a value
|
||||
i += 2
|
||||
# Otherwise, treat as a boolean flag
|
||||
else:
|
||||
key = key_part
|
||||
flags_dict[key] = True
|
||||
if key: # Ensure key is not empty (e.g. just '--')
|
||||
flags_dict[key] = True
|
||||
i += 1
|
||||
|
||||
return flags_dict
|
||||
|
|
|
|||
|
|
@ -181,4 +181,4 @@ class ConfigHandler:
|
|||
# Add slurm flag to config if running in a Slurm environment
|
||||
config["use_slurm"] = "SLURM_JOB_ID" in os.environ
|
||||
|
||||
return config
|
||||
return config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue