Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev (Sourcery refactored) #26

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _Aria2BaseClient.jsonrpc refactored with the following changes:


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))
Comment on lines -120 to +118
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _Aria2BaseClient.process_queue refactored with the following changes:


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:
Comment on lines -735 to +732
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _Aria2BaseClient.get_statuses refactored with the following changes:

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:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function read_configfile refactored with the following changes:

line = line.strip()
if line and not line.startswith("#"):
yield prefix + line
Expand Down