Skip to content

Commit

Permalink
style: manual fixes to comply with ruff
Browse files Browse the repository at this point in the history
refs: RATYK-42
  • Loading branch information
voneiden committed Jan 3, 2025
1 parent 08ce02b commit 9c7fd4b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
5 changes: 4 additions & 1 deletion helusers/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

@deprecated(
deprecated_in="0.6.0",
details="Allauth based authentication is deprecated. Use the social-auth-app-django based authentication system.",
details=(
"Allauth based authentication is deprecated. Use the social-auth-app-django"
" based authentication system."
),
)
class SocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
Expand Down
3 changes: 2 additions & 1 deletion helusers/management/commands/sync_helusers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def handle(self, *args, **options):
)
if not secret_key:
raise ImproperlyConfigured(
"You must set JWT_AUTH['JWT_SECRET_KEY'] to correspond to your secret key"
"You must set JWT_AUTH['JWT_SECRET_KEY'] to correspond to your secret"
" key"
)

if app.client_id != client_id:
Expand Down
6 changes: 4 additions & 2 deletions helusers/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class _Defaults:
def audience(self):
if not api_token_auth_settings.AUDIENCE:
raise ImproperlyConfigured(
"You must set OIDC_API_TOKEN_AUTH['AUDIENCE'] setting to the accepted JWT audience."
"You must set OIDC_API_TOKEN_AUTH['AUDIENCE'] setting to the"
" accepted JWT audience."
)
return api_token_auth_settings.AUDIENCE

Expand All @@ -45,7 +46,8 @@ def issuers(self):
issuers = api_token_auth_settings.ISSUER
if not issuers:
raise ImproperlyConfigured(
"You must set OIDC_API_TOKEN_AUTH['ISSUER'] setting to one or to a list of accepted JWT issuers."
"You must set OIDC_API_TOKEN_AUTH['ISSUER'] setting to one or to a"
" list of accepted JWT issuers."
)
if isinstance(issuers, str):
issuers = [issuers]
Expand Down
3 changes: 2 additions & 1 deletion helusers/tunnistamo_oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def get_end_session_url(self, request, id_token):
)

try:
# Add the params to the end_session URL, which might have query params already
# Add the params to the end_session URL, which might have query params
# already
url_parts = list(urlparse.urlparse(url))
query = dict(urlparse.parse_qsl(url_parts[4]))
query.update(params)
Expand Down
3 changes: 2 additions & 1 deletion helusers/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
):
if not settings.LOGOUT_REDIRECT_URL:
raise ImproperlyConfigured(
"LOGOUT_REDIRECT_URL setting must be set to use social_auth login/logout with helusers."
"LOGOUT_REDIRECT_URL setting must be set to use social_auth login/logout"
" with helusers."
)

urlpatterns.extend(
Expand Down
3 changes: 2 additions & 1 deletion helusers/user_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ def migrate_user(user_id: str, payload: dict):
[email.endswith(f"@{domain}") for domain in domains_to_migrate]
):
logger.debug(
f"User {user_id} email: {email} doesn't have a whitelisted domain, not trying to migrate."
f"User {user_id} email: {email} doesn't have a whitelisted domain, not"
" trying to migrate."
)
return

Expand Down
2 changes: 1 addition & 1 deletion helusers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_nested_from_dict(data, full_key):
'value'
>>> get_nested_from_dict({"level1": [{"level2": "value1"}, {"level2": "value2"}]}, "level1.level2")
['value1', 'value2']
"""
""" # noqa: E501
if not isinstance(data, dict) or not isinstance(full_key, str):
return None

Expand Down

0 comments on commit 9c7fd4b

Please sign in to comment.