Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Sep 16, 2023
1 parent 7f0a073 commit bbadac2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions aioaria2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion aioaria2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bbadac2

Please sign in to comment.