Another batch of linter fixes

This commit is contained in:
deajan 2025-07-03 10:24:33 +02:00
parent 67ea2bb446
commit b1799a9586
6 changed files with 9 additions and 7 deletions

View file

@ -258,8 +258,7 @@ def convert_to_commented_map(
return CommentedMap(
{k: convert_to_commented_map(v) for k, v in source_dict.items()}
)
else:
return source_dict
return source_dict
def get_default_config() -> dict:

View file

@ -49,6 +49,6 @@ def _t(*args, **kwargs):
except TypeError as exc:
logger.error("Translation failed: {}".format(exc))
logger.error("Arguments: {}".format(*args))
if len(args) > 0:
return args[0]
return args
if len(args) > 0:
return args[0]
return args

View file

@ -219,8 +219,10 @@ def send_prometheus_metrics(
upload_metrics(destination, authentication, no_cert_verify, metrics)
else:
write_metrics_file(destination, metrics, append=append_metrics_file)
return True
else:
logger.debug("No metrics destination set. Not sending metrics")
return True
def send_metrics_mail(

View file

@ -26,7 +26,7 @@ def get_restic_internal_binary(arch: str) -> str:
binary = None
if os.path.isdir(RESTIC_SOURCE_FILES_DIR):
if os.name == "nt":
if IS_LEGACY or "legacy" in "arch":
if IS_LEGACY or "legacy" in arch:
# Last compatible restic binary for Windows 7, see https://github.com/restic/restic/issues/5065
# We build a legacy version of restic for windows 7 and Server 2008R2
logger.info(

View file

@ -38,6 +38,7 @@ def handle_current_window(action: str = "minimize") -> None:
current_executable = os.path.abspath(sys.argv[0])
# console window will have the name of current executable
# pylint: disable=I1101 (c-extension-no-member)
hWnd = win32gui.FindWindow(None, current_executable)
if not hWnd:
logger.debug(

View file

@ -350,7 +350,7 @@ def gui_thread_runner(
if __fn_name == "restore":
try:
stdout_cache = json.dumps(json.loads(stdout_cache), indent=4)
except json.JSONDecodeError as exc:
except json.JSONDecodeError:
pass
# Don't update GUI if there isn't anything to update so it will avoid scrolling back to top every second
if (