From a3c43261543347e7cadb9845c4494bd7e20b8e0d Mon Sep 17 00:00:00 2001 From: deajan Date: Thu, 24 Oct 2024 17:44:48 +0200 Subject: [PATCH] Reformat files with black --- npbackup/core/runner.py | 18 +++++++++++++----- npbackup/gui/helpers.py | 6 ++---- npbackup/gui/operations.py | 11 ++++++----- npbackup/restic_wrapper/__init__.py | 5 ++++- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/npbackup/core/runner.py b/npbackup/core/runner.py index a3385e9..87ed9e4 100644 --- a/npbackup/core/runner.py +++ b/npbackup/core/runner.py @@ -1431,12 +1431,18 @@ class NPBackupRunner: # pylint: disable=E1123 (unexpected-keyword-arg) 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) - 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) 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) prune_result = self.prune(**kwargs) result = prune_result @@ -1448,12 +1454,14 @@ class NPBackupRunner: result = forget_result else: 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 else: 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 diff --git a/npbackup/gui/helpers.py b/npbackup/gui/helpers.py index 5f77506..28adc29 100644 --- a/npbackup/gui/helpers.py +++ b/npbackup/gui/helpers.py @@ -105,9 +105,7 @@ def gui_thread_runner( def _update_gui_from_cache(_stdout_cache: str = None, _stderr_cache: str = None): if _stdout_cache: - progress_window["-OPERATIONS-PROGRESS-STDOUT-"].Update( - _stdout_cache - ) + progress_window["-OPERATIONS-PROGRESS-STDOUT-"].Update(_stdout_cache) if _stderr_cache: progress_window["-OPERATIONS-PROGRESS-STDERR-"].Update( 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 __autoclose = False - if time.monotonic() -start_time > 1: + if time.monotonic() - start_time > 1: if len(stdout_cache) > 1000: stdout_cache = stdout_cache[-1000:] _update_gui_from_cache(stdout_cache, stderr_cache) diff --git a/npbackup/gui/operations.py b/npbackup/gui/operations.py index a7f91be..08109f5 100644 --- a/npbackup/gui/operations.py +++ b/npbackup/gui/operations.py @@ -89,11 +89,10 @@ def task_scheduler(repos: list): "backup", "housekeeping", "quick_check", - "full_check" - "unlock", + "full_check" "unlock", "forget", "prune", - "prune_max" + "prune_max", ] layout = [ @@ -471,8 +470,10 @@ def operations_gui(full_config: dict) -> dict: repos = _get_repo_list(values["repo-and-group-list"]) if not repos: continue - sg.Popup("Currently not implemented. Please use cron or windows task scheduler") - #task_scheduler(repos) + sg.Popup( + "Currently not implemented. Please use cron or windows task scheduler" + ) + # task_scheduler(repos) continue if event == "---STATE-UPDATE---": complete_repo_list = gui_update_state(window, full_config) diff --git a/npbackup/restic_wrapper/__init__.py b/npbackup/restic_wrapper/__init__.py index 6a7b58b..0c1aaaa 100644 --- a/npbackup/restic_wrapper/__init__.py +++ b/npbackup/restic_wrapper/__init__.py @@ -670,7 +670,10 @@ class ResticRunner: self.repository, 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 pass else: