From 80f5ac14aef63900441741538a4a6e10fd4b2977 Mon Sep 17 00:00:00 2001 From: 5hojib Date: Thu, 2 Jan 2025 18:06:54 +0000 Subject: [PATCH] Auto-format code [skip actions] --- bot/helper/common.py | 21 +++++++-------------- bot/helper/ext_utils/bot_utils.py | 6 +++--- bot/helper/ext_utils/media_utils.py | 4 +++- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/bot/helper/common.py b/bot/helper/common.py index a635187ca..580b0a1a5 100644 --- a/bot/helper/common.py +++ b/bot/helper/common.py @@ -584,7 +584,8 @@ async def decompress_zst(self, dl_path, is_dir=False): stderr = ( (await self.subproc.stderr.read()) .decode() - .strip()) + .strip() + ) except Exception: stderr = "Unable to decode the error!" LOGGER.error( @@ -607,10 +608,7 @@ async def decompress_zst(self, dl_path, is_dir=False): if code != 0: try: async with self.subprocess_lock: - stderr = ( - (await self.subproc.stderr.read()) - .decode() - .strip()) + stderr = (await self.subproc.stderr.read()).decode().strip() except Exception: stderr = "Unable to decode the error!" LOGGER.error( @@ -684,7 +682,8 @@ async def proceed_extract(self, dl_path, gid): stderr = ( (await self.subproc.stderr.read()) .decode() - .strip()) + .strip() + ) except Exception: stderr = "Unable to decode the error!" LOGGER.error( @@ -744,10 +743,7 @@ async def proceed_extract(self, dl_path, gid): return up_path try: async with self.subprocess_lock: - stderr = ( - (await self.subproc.stderr.read()) - .decode() - .strip()) + stderr = (await self.subproc.stderr.read()).decode().strip() except Exception: stderr = "Unable to decode the error!" LOGGER.error( @@ -836,10 +832,7 @@ async def proceed_compress(self, dl_path, gid, o_files, ft_delete): self.new_dir = "" try: async with self.subprocess_lock: - stderr = ( - (await self.subproc.stderr.read()) - .decode() - .strip()) + stderr = (await self.subproc.stderr.read()).decode().strip() except Exception: stderr = "Unable to decode the error!" LOGGER.error(f"{stderr}. Unable to zip this path: {dl_path}") diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py index a643c334c..fe1bf0583 100644 --- a/bot/helper/ext_utils/bot_utils.py +++ b/bot/helper/ext_utils/bot_utils.py @@ -143,9 +143,9 @@ def arg_parser(items, arg_base): if not sub_list: break check = " ".join(sub_list).strip() - if check.startswith("[") and check.endswith("]"): - break - elif not check.startswith("["): + if ( + check.startswith("[") and check.endswith("]") + ) or not check.startswith("["): break sub_list.append(items[j]) if sub_list: diff --git a/bot/helper/ext_utils/media_utils.py b/bot/helper/ext_utils/media_utils.py index 960a39c97..7386d556e 100644 --- a/bot/helper/ext_utils/media_utils.py +++ b/bot/helper/ext_utils/media_utils.py @@ -512,7 +512,9 @@ async def split_file( if code != 0: try: async with listener.subprocess_lock: - stderr = (await listener.subproc.stderr.read()).decode().strip() + stderr = ( + (await listener.subproc.stderr.read()).decode().strip() + ) except Exception: stderr = "Unable to decode the error!" with contextlib.suppress(Exception):