Fix static analysis issues

This commit is contained in:
Ian Renton
2026-02-27 20:33:45 +00:00
parent 6982354364
commit 3792e9f4d9
17 changed files with 36 additions and 38 deletions

View File

@@ -10,7 +10,8 @@ if not os.path.isfile("config.yml"):
exit()
# Load config
config = yaml.safe_load(open("config.yml"))
with open("config.yml") as f:
config = yaml.safe_load(f)
logging.info("Loaded config.")
MAX_SPOT_AGE = config["max-spot-age-sec"]
@@ -23,7 +24,7 @@ WEB_UI_OPTIONS = config["web-ui-options"]
# For ease of config, each spot provider owns its own config about whether it should be enabled by default in the web UI
# but for consistency we provide this to the front-end in web-ui-options because it has no impact outside of the web UI.
WEB_UI_OPTIONS["spot-providers-enabled-by-default"] = [p["name"] for p in config["spot-providers"] if p["enabled"] and (
"enabled-by-default-in-web-ui" not in p or p["enabled-by-default-in-web-ui"] == True)]
"enabled-by-default-in-web-ui" not in p or p["enabled-by-default-in-web-ui"])]
# If spotting to this server is enabled, "API" is another valid spot source even though it does not come from
# one of our proviers. We set that to also be enabled by default.
if ALLOW_SPOTTING: