-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)) | ||
Comment on lines
-120
to
+118
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
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: | ||
Comment on lines
-735
to
+732
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
yield "error" | ||
|
||
async def close(self) -> None: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
line = line.strip() | ||
if line and not line.startswith("#"): | ||
yield prefix + line | ||
|
There was a problem hiding this comment.
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:reintroduce-else
)assign-if-exp
)