-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sourcery refactored master branch #1
base: master
Are you sure you want to change the base?
Conversation
if results: | ||
return results[0] | ||
return None | ||
return results[0] if results else None |
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 Queue.apply
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
if not pending_job_keys: | ||
return True | ||
|
||
return False | ||
return not pending_job_keys |
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 Queue.map
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
) - Simplify boolean if expression (
boolean-if-exp-identity
) - Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast
)
resp = await handler(request) | ||
return resp | ||
return await handler(request) |
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 exceptions
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
password = os.environ.get("AUTH_PASSWORD") | ||
|
||
if password: | ||
if password := os.environ.get("AUTH_PASSWORD"): |
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 create_app
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
if not info.get("name") == queue.name: | ||
if info.get("name") != queue.name: |
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 async_check_health
refactored with the following changes:
- Simplify logical expression using De Morgan identities (
de-morgan
)
self.assertEqual( | ||
set(q["name"] for q in json["queues"]), {"queue1", "queue2"} | ||
) | ||
self.assertEqual({q["name"] for q in json["queues"]}, {"queue1", "queue2"}) |
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 TestWorker.test_queues
refactored with the following changes:
- Replace list(), dict() or set() with comprehension (
collection-builtin-to-comprehension
)
Branch
master
refactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run:Help us improve this pull request!