From 9d994e8750917b22faf4c4210abb25a1afe7307a Mon Sep 17 00:00:00 2001 From: Simon <37269807+sdsznsk@users.noreply.github.com> Date: Wed, 1 Nov 2023 15:45:48 +0100 Subject: [PATCH] Comply with lint - rename var names in json mods logic to be more clear --- launch.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/launch.py b/launch.py index fd914d1..052b661 100644 --- a/launch.py +++ b/launch.py @@ -135,10 +135,16 @@ def bool_str(text): with open(os.environ["GAME_MODS_JSON_FILE_PATH"]) as f: json_mods = json.load(f) allowed_keys = ["modId", "name", "version"] - for mod in json_mods: - assert "modId" in mod, f"Entry in GAME_MODS_JSON_FILE_PATH file does not contain modId: {mod}" - mod = {key: mod[key] for key in allowed_keys if key in mod} # Extract only valid config keys - config["game"]["mods"].append(mod) + for provided_mod in json_mods: + assert ( + "modId" in provided_mod + ), f"Entry in GAME_MODS_JSON_FILE_PATH file does not contain modId: {provided_mod}" + valid_mod = { + key: provided_mod[key] + for key in allowed_keys + if key in provided_mod + } # Extract only valid config keys + config["game"]["mods"].append(valid_mod) f = open(CONFIG_GENERATED, "w") json.dump(config, f, indent=4)