From c021109eebea57fd613ce79a610f5ec3a28be6af Mon Sep 17 00:00:00 2001 From: 5hojib Date: Mon, 23 Dec 2024 11:50:12 +0000 Subject: [PATCH] Auto-format code [skip actions] --- bot/__init__.py | 3 ++- bot/helper/listeners/qbit_listener.py | 18 ++++++++++-------- web/nodes.py | 7 +++++-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/bot/__init__.py b/bot/__init__.py index 4dc5d65f1..0e473b7a2 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -483,7 +483,8 @@ def format(self, record: LogRecord) -> str: if ospath.exists("accounts"): rmtree("accounts") subprocess.run( - ["7z", "x", "-o.", "-aoa", "accounts.zip", "accounts/*.json"], check=False + ["7z", "x", "-o.", "-aoa", "accounts.zip", "accounts/*.json"], + check=False, ) subprocess.run(["chmod", "-R", "777", "accounts"], check=False) remove("accounts.zip") diff --git a/bot/helper/listeners/qbit_listener.py b/bot/helper/listeners/qbit_listener.py index 13fb8ffa7..49c1992e8 100644 --- a/bot/helper/listeners/qbit_listener.py +++ b/bot/helper/listeners/qbit_listener.py @@ -58,14 +58,16 @@ async def _on_seed_finish(tor): @new_task async def _stop_duplicate(tor): - if (task := await get_task_by_gid(tor.hash[:12])) and task.listener.stop_duplicate: - task.listener.name = tor.content_path.rsplit("/", 1)[-1].rsplit( - ".!qB", - 1, - )[0] - msg, button = await stop_duplicate_check(task.listener) - if msg: - _on_download_error(msg, tor, button) + if ( + task := await get_task_by_gid(tor.hash[:12]) + ) and task.listener.stop_duplicate: + task.listener.name = tor.content_path.rsplit("/", 1)[-1].rsplit( + ".!qB", + 1, + )[0] + msg, button = await stop_duplicate_check(task.listener) + if msg: + _on_download_error(msg, tor, button) @new_task diff --git a/web/nodes.py b/web/nodes.py index 66d8e9712..9eb69c0a0 100644 --- a/web/nodes.py +++ b/web/nodes.py @@ -111,7 +111,9 @@ def make_tree(res, tool=False): else: previous_node = current_node try: - progress = round((int(i["completedLength"]) / int(i["length"])) * 100, 5) + progress = round( + (int(i["completedLength"]) / int(i["length"])) * 100, 5 + ) except: progress = 0 TorNode( @@ -126,7 +128,8 @@ def make_tree(res, tool=False): else: try: progress = round( - (int(i["completedLength"]) / int(i["length"])) * 100, 5 + (int(i["completedLength"]) / int(i["length"])) * 100, + 5, ) except: progress = 0