Reformat files with black

This commit is contained in:
deajan 2024-10-24 17:44:48 +02:00
parent 93fd81175e
commit a3c4326154
4 changed files with 25 additions and 15 deletions

View file

@ -1431,12 +1431,18 @@ class NPBackupRunner:
# pylint: disable=E1123 (unexpected-keyword-arg) # pylint: disable=E1123 (unexpected-keyword-arg)
unlock_result = self.unlock(**kwargs) unlock_result = self.unlock(**kwargs)
if (isinstance(unlock_result, bool) and unlock_result) or (isinstance(unlock_result, dict) and unlock_result["result"]): if (isinstance(unlock_result, bool) and unlock_result) or (
isinstance(unlock_result, dict) and unlock_result["result"]
):
check_result = self.check(**kwargs, read_data=False) check_result = self.check(**kwargs, read_data=False)
if (isinstance(check_result, bool) and check_result) or (isinstance(check_result, dict) and check_result["result"]): if (isinstance(check_result, bool) and check_result) or (
isinstance(check_result, dict) and check_result["result"]
):
# pylint: disable=E1123 (unexpected-keyword-arg) # pylint: disable=E1123 (unexpected-keyword-arg)
forget_result = self.forget(use_policy=True, **kwargs) forget_result = self.forget(use_policy=True, **kwargs)
if (isinstance(forget_result, bool) and forget_result) or (isinstance(forget_result, dict) and forget_result["result"]): if (isinstance(forget_result, bool) and forget_result) or (
isinstance(forget_result, dict) and forget_result["result"]
):
# pylint: disable=E1123 (unexpected-keyword-arg) # pylint: disable=E1123 (unexpected-keyword-arg)
prune_result = self.prune(**kwargs) prune_result = self.prune(**kwargs)
result = prune_result result = prune_result
@ -1448,12 +1454,14 @@ class NPBackupRunner:
result = forget_result result = forget_result
else: else:
self.write_logs( self.write_logs(
f"Check failed. Won't continue housekeeping on repo {self.repo_config.g('name')}", level="error" f"Check failed. Won't continue housekeeping on repo {self.repo_config.g('name')}",
level="error",
) )
result = check_result result = check_result
else: else:
self.write_logs( self.write_logs(
f"Unlock failed. Won't continue housekeeping in repo {self.repo_config.g('name')}", level="error" f"Unlock failed. Won't continue housekeeping in repo {self.repo_config.g('name')}",
level="error",
) )
result = unlock_result result = unlock_result

View file

@ -105,9 +105,7 @@ def gui_thread_runner(
def _update_gui_from_cache(_stdout_cache: str = None, _stderr_cache: str = None): def _update_gui_from_cache(_stdout_cache: str = None, _stderr_cache: str = None):
if _stdout_cache: if _stdout_cache:
progress_window["-OPERATIONS-PROGRESS-STDOUT-"].Update( progress_window["-OPERATIONS-PROGRESS-STDOUT-"].Update(_stdout_cache)
_stdout_cache
)
if _stderr_cache: if _stderr_cache:
progress_window["-OPERATIONS-PROGRESS-STDERR-"].Update( progress_window["-OPERATIONS-PROGRESS-STDERR-"].Update(
f"\n{_stderr_cache}", append=True f"\n{_stderr_cache}", append=True
@ -326,7 +324,7 @@ def gui_thread_runner(
# Make sure we will keep the window visible since we have errors # Make sure we will keep the window visible since we have errors
__autoclose = False __autoclose = False
if time.monotonic() -start_time > 1: if time.monotonic() - start_time > 1:
if len(stdout_cache) > 1000: if len(stdout_cache) > 1000:
stdout_cache = stdout_cache[-1000:] stdout_cache = stdout_cache[-1000:]
_update_gui_from_cache(stdout_cache, stderr_cache) _update_gui_from_cache(stdout_cache, stderr_cache)

View file

@ -89,11 +89,10 @@ def task_scheduler(repos: list):
"backup", "backup",
"housekeeping", "housekeeping",
"quick_check", "quick_check",
"full_check" "full_check" "unlock",
"unlock",
"forget", "forget",
"prune", "prune",
"prune_max" "prune_max",
] ]
layout = [ layout = [
@ -471,8 +470,10 @@ def operations_gui(full_config: dict) -> dict:
repos = _get_repo_list(values["repo-and-group-list"]) repos = _get_repo_list(values["repo-and-group-list"])
if not repos: if not repos:
continue continue
sg.Popup("Currently not implemented. Please use cron or windows task scheduler") sg.Popup(
#task_scheduler(repos) "Currently not implemented. Please use cron or windows task scheduler"
)
# task_scheduler(repos)
continue continue
if event == "---STATE-UPDATE---": if event == "---STATE-UPDATE---":
complete_repo_list = gui_update_state(window, full_config) complete_repo_list = gui_update_state(window, full_config)

View file

@ -670,7 +670,10 @@ class ResticRunner:
self.repository, self.repository,
self.repository.split(":")[0] + ":_(o_O)_hidden_by_npbackup", self.repository.split(":")[0] + ":_(o_O)_hidden_by_npbackup",
) )
if "repository is already locked" in output and fn.__name__ == "unlock": if (
"repository is already locked" in output
and fn.__name__ == "unlock"
):
# our is ready check should not fail if repo is locked # our is ready check should not fail if repo is locked
pass pass
else: else: