mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
18
Utils.py
18
Utils.py
@@ -221,19 +221,29 @@ def get_default_options() -> dict:
|
|||||||
get_default_options.options = options
|
get_default_options.options = options
|
||||||
return get_default_options.options
|
return get_default_options.options
|
||||||
|
|
||||||
|
|
||||||
|
blacklisted_options = {"multi_mystery_options.cpu_threads",
|
||||||
|
"multi_mystery_options.max_attempts",
|
||||||
|
"multi_mystery_options.take_first_working",
|
||||||
|
"multi_mystery_options.keep_all_seeds",
|
||||||
|
"multi_mystery_options.log_output_path",
|
||||||
|
"multi_mystery_options.log_level"}
|
||||||
|
|
||||||
|
|
||||||
def update_options(src: dict, dest: dict, filename: str, keys: list) -> dict:
|
def update_options(src: dict, dest: dict, filename: str, keys: list) -> dict:
|
||||||
import logging
|
import logging
|
||||||
for key, value in src.items():
|
for key, value in src.items():
|
||||||
new_keys = keys.copy()
|
new_keys = keys.copy()
|
||||||
new_keys.append(key)
|
new_keys.append(key)
|
||||||
|
option_name = '.'.join(new_keys)
|
||||||
if key not in dest:
|
if key not in dest:
|
||||||
dest[key] = value
|
dest[key] = value
|
||||||
if filename.endswith("options.yaml"):
|
if filename.endswith("options.yaml") and option_name not in blacklisted_options:
|
||||||
logging.info(f"Warning: {filename} is missing {'.'.join(new_keys)}")
|
logging.info(f"Warning: {filename} is missing {option_name}")
|
||||||
elif isinstance(value, dict):
|
elif isinstance(value, dict):
|
||||||
if not isinstance(dest.get(key, None), dict):
|
if not isinstance(dest.get(key, None), dict):
|
||||||
if filename.endswith("options.yaml"):
|
if filename.endswith("options.yaml") and option_name not in blacklisted_options:
|
||||||
logging.info(f"Warning: {filename} has {'.'.join(new_keys)}, but it is not a dictionary. overwriting.")
|
logging.info(f"Warning: {filename} has {option_name}, but it is not a dictionary. overwriting.")
|
||||||
dest[key] = value
|
dest[key] = value
|
||||||
else:
|
else:
|
||||||
dest[key] = update_options(value, dest[key], filename, new_keys)
|
dest[key] = update_options(value, dest[key], filename, new_keys)
|
||||||
|
Reference in New Issue
Block a user