From 9f52b43b90cc0f6d992d93f4cc1951742a924b86 Mon Sep 17 00:00:00 2001 From: Raymond Penners Date: Wed, 19 May 2021 16:46:55 +0200 Subject: [PATCH] chore: Fixed black issues --- allauth/socialaccount/providers/apple/client.py | 2 +- allauth/socialaccount/providers/apple/tests.py | 2 +- allauth/socialaccount/providers/apple/views.py | 2 +- .../socialaccount/providers/frontier/provider.py | 15 ++++++++++----- allauth/socialaccount/providers/strava/tests.py | 2 +- tox.ini | 6 +++--- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/allauth/socialaccount/providers/apple/client.py b/allauth/socialaccount/providers/apple/client.py index 16e97a1904..35845f4453 100644 --- a/allauth/socialaccount/providers/apple/client.py +++ b/allauth/socialaccount/providers/apple/client.py @@ -55,7 +55,7 @@ def generate_client_secret(self): return client_secret def get_client_id(self): - """ We support multiple client_ids, but use the first one for api calls """ + """We support multiple client_ids, but use the first one for api calls""" return self.consumer_key.split(",")[0] def get_access_token(self, code): diff --git a/allauth/socialaccount/providers/apple/tests.py b/allauth/socialaccount/providers/apple/tests.py index e3c390b10b..ce9e6a79d2 100644 --- a/allauth/socialaccount/providers/apple/tests.py +++ b/allauth/socialaccount/providers/apple/tests.py @@ -212,7 +212,7 @@ def login(self, resp_mock, process="login", with_refresh_token=True): return resp def test_authentication_error(self): - """ Override base test because apple posts errors """ + """Override base test because apple posts errors""" resp = self.client.post( reverse(self.provider.id + "_callback"), data={"error": "misc", "state": "testingstate123"}, diff --git a/allauth/socialaccount/providers/apple/views.py b/allauth/socialaccount/providers/apple/views.py index 94f74b970d..873ba110fc 100644 --- a/allauth/socialaccount/providers/apple/views.py +++ b/allauth/socialaccount/providers/apple/views.py @@ -118,7 +118,7 @@ def get_user_scope_data(self, request): return {} def get_access_token_data(self, request, app, client): - """ We need to gather the info from the apple specific login """ + """We need to gather the info from the apple specific login""" add_apple_session(request) # Exchange `code` diff --git a/allauth/socialaccount/providers/frontier/provider.py b/allauth/socialaccount/providers/frontier/provider.py index 65c23efaee..94a3546403 100644 --- a/allauth/socialaccount/providers/frontier/provider.py +++ b/allauth/socialaccount/providers/frontier/provider.py @@ -12,13 +12,18 @@ def get_profile_url(self): def get_avatar_url(self): return "https://www.gravatar.com/avatar/%s?%s" % ( - hashlib.md5(self.account.extra_data.get("email").lower().encode('utf-8')).hexdigest(), - urlencode({'d': 'mp'})) + hashlib.md5( + self.account.extra_data.get("email").lower().encode("utf-8") + ).hexdigest(), + urlencode({"d": "mp"}), + ) def to_str(self): dflt = super(FrontierAccount, self).to_str() - full_name = "%s %s" % (self.account.extra_data.get("firstname", dflt), - self.account.extra_data.get("lastname", dflt)) + full_name = "%s %s" % ( + self.account.extra_data.get("firstname", dflt), + self.account.extra_data.get("lastname", dflt), + ) return full_name @@ -28,7 +33,7 @@ class FrontierProvider(OAuth2Provider): account_class = FrontierAccount def get_default_scope(self): - scope = ['auth', 'capi'] + scope = ["auth", "capi"] return scope def extract_uid(self, data): diff --git a/allauth/socialaccount/providers/strava/tests.py b/allauth/socialaccount/providers/strava/tests.py index 7b6655e281..c0bd0291f1 100644 --- a/allauth/socialaccount/providers/strava/tests.py +++ b/allauth/socialaccount/providers/strava/tests.py @@ -68,7 +68,7 @@ def get_mocked_response_avatar_invalid_id(self): ) # noqa def test_valid_avatar(self): - """ test response with Avatar URL """ + """test response with Avatar URL""" self.login(self.get_mocked_response_avatar_invalid_id()) user = User.objects.get(email="bill@example.com") soc_acc = SocialAccount.objects.filter( diff --git a/tox.ini b/tox.ini index c66d4a4f40..5f83163876 100644 --- a/tox.ini +++ b/tox.ini @@ -40,9 +40,9 @@ commands = skip_install = True ignore_errors = True deps = - flake8 - isort - black + flake8==3.9.2 + isort==5.8.0 + black==21.5b1 commands = flake8 {posargs:{toxinidir}/allauth} isort --check-only --skip-glob '*/migrations/*' --diff {posargs:{toxinidir}/allauth}