mirror of
https://github.com/netinvent/npbackup.git
synced 2025-10-13 15:07:24 +08:00
Reformat files with black
This commit is contained in:
parent
93fd81175e
commit
a3c4326154
4 changed files with 25 additions and 15 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue