-
Notifications
You must be signed in to change notification settings - Fork 1
Sourcery Starbot ⭐ refactored ypeng90/account-api #1
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
base: master
Are you sure you want to change the base?
Conversation
if model._meta.model_name in models_using_querydb: | ||
return "querydb" | ||
|
||
return None | ||
return "querydb" if model._meta.model_name in models_using_querydb 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 DBRouter.db_for_read
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
)
@@ -10,6 +10,7 @@ | |||
https://docs.djangoproject.com/en/3.2/ref/settings/ | |||
""" | |||
|
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.
Lines 320-335
refactored with the following changes:
- Replace call to format with f-string [×2] (
use-fstring-for-formatting
)
commit_position = self.append_events( | ||
return self.append_events( | ||
stream_name=self.stream_name, | ||
expected_position=expected_position, | ||
events=[self.event], | ||
) | ||
|
||
return commit_position |
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 ESClient.send
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
recorded = self.read_stream_events( | ||
return self.read_stream_events( | ||
stream_name=self.stream_name, stream_position=stream_position | ||
) | ||
|
||
return recorded |
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 ESClient.receive
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
subscription = self.subscribe_stream_events( | ||
return self.subscribe_stream_events( | ||
stream_name=self.stream_name, stream_position=stream_position | ||
) | ||
return subscription |
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 ESClient.subscribe
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
result = db["stream_positions"].find_one({"stream_type": "user"}) | ||
if result: | ||
if result := db["stream_positions"].find_one({"stream_type": "user"}): |
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 catch_up_user_events
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
result = db["stream_positions"].find_one({"stream_type": "token"}) | ||
if result: | ||
if result := db["stream_positions"].find_one({"stream_type": "token"}): |
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 catch_up_token_events
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
service = build("gmail", "v1", credentials=creds) | ||
return service | ||
return build("gmail", "v1", credentials=creds) |
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 Gmail.init_service
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨
Here's your pull request refactoring your most popular Python repo.
If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run: