-
-
Notifications
You must be signed in to change notification settings - Fork 53
feat: add MFA bindings (Sourcery refactored) #212
Conversation
| payload = self._decode_jwt(access_token) | ||
| exp = payload.get("exp") | ||
| if exp: | ||
| if exp := payload.get("exp"): |
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.set_session refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| error_description = self._get_param(params, "error_description") | ||
| if error_description: | ||
| if error_description := self._get_param(params, "error_description"): |
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._get_session_from_url refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| expire_at = session.expires_at | ||
| if expire_at: | ||
| if expire_at := session.expires_at: |
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._save_session refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| if not jwt: | ||
| session = self.get_session() | ||
| if session: | ||
| if session := self.get_session(): |
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.get_user refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| exp = payload.get("exp") | ||
| if exp: | ||
| if exp := payload.get("exp"): |
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.set_session refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| session = self.get_session() | ||
| if not session: | ||
| if session := self.get_session(): | ||
| return self._request( | ||
| "POST", | ||
| f"factors/{params.get('factor_id')}/challenge", | ||
| jwt=session.access_token, | ||
| xform=AuthMFAChallengeResponse.parse_obj, | ||
| ) | ||
| else: | ||
| raise AuthSessionMissingError() | ||
| return self._request( | ||
| "POST", | ||
| f"factors/{params.get('factor_id')}/challenge", | ||
| jwt=session.access_token, | ||
| xform=AuthMFAChallengeResponse.parse_obj, | ||
| ) |
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._challenge refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression) - Lift code into else after jump in control flow (
reintroduce-else) - Swap if/else branches (
swap-if-else-branches)
| session = self.get_session() | ||
| if not session: | ||
| if session := self.get_session(): | ||
| return self._request( | ||
| "DELETE", | ||
| f"factors/{params.get('factor_id')}", | ||
| jwt=session.access_token, | ||
| xform=AuthMFAUnenrollResponse.parse_obj, | ||
| ) | ||
| else: | ||
| raise AuthSessionMissingError() | ||
| return self._request( | ||
| "DELETE", | ||
| f"factors/{params.get('factor_id')}", | ||
| jwt=session.access_token, | ||
| xform=AuthMFAUnenrollResponse.parse_obj, | ||
| ) |
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._unenroll refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression) - Lift code into else after jump in control flow (
reintroduce-else) - Swap if/else branches (
swap-if-else-branches)
| error_description = self._get_param(params, "error_description") | ||
| if error_description: | ||
| if error_description := self._get_param(params, "error_description"): |
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._get_session_from_url refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
| expire_at = session.expires_at | ||
| if expire_at: | ||
| if expire_at := session.expires_at: |
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._save_session refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression)
Pull Request #196 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
j0/add_mfa_bindingsbranch, then run:Help us improve this pull request!