-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: add create user param to sign in (Sourcery refactored) #76
feat: add create user param to sign in (Sourcery refactored) #76
Conversation
self.api = api if api else AsyncGoTrueAPI(**args) | ||
self.api = api or AsyncGoTrueAPI(**args) |
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 AsyncGoTrueClient.__init__
refactored with the following changes:
- Simplify if expression by using or (
or-if-exp-identity
)
elif email and password: | ||
elif email: |
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 AsyncGoTrueClient.sign_in
refactored with the following changes:
- Remove redundant conditional (
remove-redundant-if
)
if expires_at < time_now: | ||
if self.auto_refresh_token and session.refresh_token: | ||
try: | ||
await self._call_refresh_token(refresh_token=session.refresh_token) | ||
except APIError: | ||
await self._remove_session() | ||
else: | ||
if ( | ||
expires_at < time_now | ||
and self.auto_refresh_token | ||
and session.refresh_token | ||
): | ||
try: | ||
await self._call_refresh_token(refresh_token=session.refresh_token) | ||
except APIError: | ||
await self._remove_session() | ||
elif not session or not session.user: | ||
elif expires_at < time_now or not session or not session.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 AsyncGoTrueClient._recover_and_refresh
refactored with the following changes:
- Merge duplicate blocks in conditional (
merge-duplicate-blocks
) - Remove redundant conditional (
remove-redundant-if
)
self.api = api if api else SyncGoTrueAPI(**args) | ||
self.api = api or SyncGoTrueAPI(**args) |
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 SyncGoTrueClient.__init__
refactored with the following changes:
- Simplify if expression by using or (
or-if-exp-identity
)
elif email and password: | ||
elif email: |
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 SyncGoTrueClient.sign_in
refactored with the following changes:
- Remove redundant conditional (
remove-redundant-if
)
response = self._call_refresh_token() | ||
return response | ||
return self._call_refresh_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 SyncGoTrueClient.refresh_session
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
response = self.api.get_url_for_provider( | ||
return self.api.get_url_for_provider( | ||
provider=provider, | ||
redirect_to=redirect_to, | ||
scopes=scopes, | ||
) | ||
return response |
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 SyncGoTrueClient._handle_provider_sign_in
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
if expires_at < time_now: | ||
if self.auto_refresh_token and session.refresh_token: | ||
try: | ||
self._call_refresh_token(refresh_token=session.refresh_token) | ||
except APIError: | ||
self._remove_session() | ||
else: | ||
if ( | ||
expires_at < time_now | ||
and self.auto_refresh_token | ||
and session.refresh_token | ||
): | ||
try: | ||
self._call_refresh_token(refresh_token=session.refresh_token) | ||
except APIError: | ||
self._remove_session() | ||
elif not session or not session.user: | ||
elif expires_at < time_now or not session or not session.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 SyncGoTrueClient._recover_and_refresh
refactored with the following changes:
- Merge duplicate blocks in conditional (
merge-duplicate-blocks
) - Remove redundant conditional (
remove-redundant-if
)
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.14%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
* feat: add create user param to sign in ref: supabase/auth#318 * 'Refactored by Sourcery' (#76) Co-authored-by: Sourcery AI <> * chore: format code * chore: format code Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Pull Request #75 refactored by Sourcery.
If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.
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
feat/add-create-user-param-to-sign-in
branch, then run:Help us improve this pull request!