Format files with black

This commit is contained in:
Orsiris de Jong 2024-07-27 13:38:13 +02:00
parent b2ccdf0190
commit f8850bd018
2 changed files with 18 additions and 8 deletions

View file

@ -62,4 +62,4 @@ def fmt_json(js: dict):
to be loaded to be loaded
""" """
js = json.dumps(js, indent=4) js = json.dumps(js, indent=4)
return js return js

View file

@ -148,10 +148,14 @@ def config_gui(full_config: dict, config_file: str):
if event in (sg.WIN_CLOSED, sg.WIN_X_EVENT, "--CANCEL--"): if event in (sg.WIN_CLOSED, sg.WIN_X_EVENT, "--CANCEL--"):
break break
if event == "--ACCEPT--": if event == "--ACCEPT--":
object_type = 'groups' if values["-OBJECT-TYPE-"] == 'group' else 'repos' object_type = (
"groups" if values["-OBJECT-TYPE-"] == "group" else "repos"
)
object_name = values["-OBJECT-NAME-"] object_name = values["-OBJECT-NAME-"]
if object_name is None or object_name == "": if object_name is None or object_name == "":
sg.PopupError(_t("config_gui.object_name_cannot_be_empty"), keep_on_top=True) sg.PopupError(
_t("config_gui.object_name_cannot_be_empty"), keep_on_top=True
)
continue continue
if object_type == "repos": if object_type == "repos":
if full_config.g(f"{object_type}.{object_name}"): if full_config.g(f"{object_type}.{object_name}"):
@ -219,8 +223,10 @@ def config_gui(full_config: dict, config_file: str):
else: else:
object_type = None object_type = None
object_name = None object_name = None
logger.error(f"Could not obtain object_type and object_name from {combo_value}") logger.error(
f"Could not obtain object_type and object_name from {combo_value}"
)
return object_type, object_name return object_type, object_name
def update_gui_values(key, value, inherited, object_type, unencrypted): def update_gui_values(key, value, inherited, object_type, unencrypted):
@ -667,9 +673,13 @@ def config_gui(full_config: dict, config_file: str):
"repo_opts.upload_speed", "repo_opts.upload_speed",
"repo_opts.download_speed", "repo_opts.download_speed",
): ):
if full_config.g(inheritance_key) is not None and value is not None and ( if (
BytesConverter(full_config.g(inheritance_key)).bytes full_config.g(inheritance_key) is not None
== BytesConverter(value).bytes and value is not None
and (
BytesConverter(full_config.g(inheritance_key)).bytes
== BytesConverter(value).bytes
)
): ):
continue continue