Avoid unnecessary isfile/exists calls

This commit is contained in:
Aarni Koskela
2024-01-04 00:16:58 +02:00
parent e4dcdcc955
commit d9034b48a5
10 changed files with 41 additions and 35 deletions

View File

@@ -245,9 +245,10 @@ def list_extensions(settings_file):
settings = {}
try:
if os.path.isfile(settings_file):
with open(settings_file, "r", encoding="utf8") as file:
settings = json.load(file)
with open(settings_file, "r", encoding="utf8") as file:
settings = json.load(file)
except FileNotFoundError:
pass
except Exception:
errors.report("Could not load settings", exc_info=True)