From bbadac2fc3dd50647eda45af60689509e076f9eb Mon Sep 17 00:00:00 2001 From: Sourcery AI <> Date: Sat, 16 Sep 2023 16:31:01 +0000 Subject: [PATCH] 'Refactored by Sourcery' --- aioaria2/client.py | 9 +++------ aioaria2/utils.py | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/aioaria2/client.py b/aioaria2/client.py index 28449fd..055dfd1 100644 --- a/aioaria2/client.py +++ b/aioaria2/client.py @@ -99,9 +99,7 @@ async def jsonrpc( if self.mode == "batch": await self.queue.put(req_obj) return None - if self.mode == "format": - return req_obj - return await self.send_request(req_obj) + return req_obj if self.mode == "format" else await self.send_request(req_obj) async def send_request(self, req_obj: Dict[str, Any]) -> Union[Dict[str, Any], Any]: raise NotImplementedError @@ -117,8 +115,7 @@ async def process_queue(self) -> List: while not self.queue.empty(): req_objs.append(await self.queue.get()) - results = await asyncio.gather(*map(self.send_request, req_objs)) - return results + return await asyncio.gather(*map(self.send_request, req_objs)) async def addUri( self, uris: List[str], options: Dict[str, Any] = None, position: int = None @@ -732,7 +729,7 @@ async def get_statuses( except KeyError: yield "error" else: - for gid in gids: + for _ in gids: yield "error" async def close(self) -> None: diff --git a/aioaria2/utils.py b/aioaria2/utils.py index c7597a0..a278d6e 100644 --- a/aioaria2/utils.py +++ b/aioaria2/utils.py @@ -150,7 +150,7 @@ def read_configfile(path: str, prefix: str = "--") -> Generator[str, None, None] :return: """ with open(path, "r") as f: - for line in f.readlines(): + for line in f: line = line.strip() if line and not line.startswith("#"): yield prefix + line