Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Conversation

@sourcery-ai
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Jan 17, 2023

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_bindings branch, then run:

git fetch origin sourcery/j0/add_mfa_bindings
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from J0 January 17, 2023 08:44
payload = self._decode_jwt(access_token)
exp = payload.get("exp")
if exp:
if exp := payload.get("exp"):
Copy link
Contributor Author

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:

Comment on lines -645 to +644
error_description = self._get_param(params, "error_description")
if error_description:
if error_description := self._get_param(params, "error_description"):
Copy link
Contributor Author

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:

Comment on lines -744 to +742
expire_at = session.expires_at
if expire_at:
if expire_at := session.expires_at:
Copy link
Contributor Author

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:

if not jwt:
session = self.get_session()
if session:
if session := self.get_session():
Copy link
Contributor Author

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:

Comment on lines -420 to +419
exp = payload.get("exp")
if exp:
if exp := payload.get("exp"):
Copy link
Contributor Author

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:

Comment on lines -539 to -547
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,
)
Copy link
Contributor Author

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:

Comment on lines -583 to -591
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,
)
Copy link
Contributor Author

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:

Comment on lines -643 to +641
error_description = self._get_param(params, "error_description")
if error_description:
if error_description := self._get_param(params, "error_description"):
Copy link
Contributor Author

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:

Comment on lines -742 to +739
expire_at = session.expires_at
if expire_at:
if expire_at := session.expires_at:
Copy link
Contributor Author

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:

@J0 J0 merged commit 4bc725d into j0/add_mfa_bindings Jan 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants