From 0e30cd297a5935eebef6b8b945f9a25f0b45a060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pazderka?= Date: Tue, 30 Jan 2024 14:49:25 +0100 Subject: [PATCH] Apply black --- src/oic/extension/sts.py | 1 + src/oic/oic/__init__.py | 6 +++--- src/oic/oic/consumer.py | 4 +--- src/oic/utils/clientdb.py | 1 + src/oic/utils/rp/oauth2.py | 6 +++--- src/oic/utils/settings.py | 1 + tests/conftest.py | 1 + tests/test_clientdb.py | 1 + tests/test_x_provider.py | 18 +++++++++--------- 9 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/oic/extension/sts.py b/src/oic/extension/sts.py index 160cccdb7..0dd740952 100644 --- a/src/oic/extension/sts.py +++ b/src/oic/extension/sts.py @@ -5,6 +5,7 @@ :license: Apache2, see LICENSE for more details. """ + import json from oic.oauth2.message import OPTIONAL_LIST_OF_SP_SEP_STRINGS diff --git a/src/oic/oic/__init__.py b/src/oic/oic/__init__.py index 83fd165ec..f4b2a503f 100644 --- a/src/oic/oic/__init__.py +++ b/src/oic/oic/__init__.py @@ -1240,9 +1240,9 @@ def match_preferences(self, pcr=None, issuer=None): def store_registration_info(self, reginfo): self.registration_response = reginfo if "token_endpoint_auth_method" not in self.registration_response: - self.registration_response[ - "token_endpoint_auth_method" # nosec - ] = "client_secret_basic" + self.registration_response["token_endpoint_auth_method"] = ( # nosec + "client_secret_basic" + ) self.client_id = reginfo["client_id"] try: self.client_secret = reginfo["client_secret"] diff --git a/src/oic/oic/consumer.py b/src/oic/oic/consumer.py index e8a329b25..e0a856ab2 100644 --- a/src/oic/oic/consumer.py +++ b/src/oic/oic/consumer.py @@ -367,9 +367,7 @@ def _parse_authz(self, query="", **kwargs): self.redirect_uris = [self.sdb[_state]["redirect_uris"]] return aresp, _state - def parse_authz( - self, query="", **kwargs - ) -> Union[ + def parse_authz(self, query="", **kwargs) -> Union[ http_util.BadRequest, Tuple[ Optional[AuthorizationResponse], diff --git a/src/oic/utils/clientdb.py b/src/oic/utils/clientdb.py index 24e20c003..cd2713d33 100644 --- a/src/oic/utils/clientdb.py +++ b/src/oic/utils/clientdb.py @@ -1,4 +1,5 @@ """Client management databases.""" + from abc import ABCMeta from abc import abstractmethod from urllib.parse import quote diff --git a/src/oic/utils/rp/oauth2.py b/src/oic/utils/rp/oauth2.py index 923d89afd..a344b2225 100644 --- a/src/oic/utils/rp/oauth2.py +++ b/src/oic/utils/rp/oauth2.py @@ -116,9 +116,9 @@ def callback(self, response, session, format="dict"): :return: """ if self.behaviour["response_type"] == "code": - respcls: Union[ - Type[AuthorizationResponse], Type[AccessTokenResponse] - ] = AuthorizationResponse + respcls: Union[Type[AuthorizationResponse], Type[AccessTokenResponse]] = ( + AuthorizationResponse + ) else: respcls = AccessTokenResponse diff --git a/src/oic/utils/settings.py b/src/oic/utils/settings.py index 77ea6a37a..e88ea4be4 100644 --- a/src/oic/utils/settings.py +++ b/src/oic/utils/settings.py @@ -12,6 +12,7 @@ The settings make use of `pydantic-settings `_ library. It is possible to instance them directly or use environment values to fill the settings. """ + from typing import Optional from typing import Tuple from typing import Union diff --git a/tests/conftest.py b/tests/conftest.py index 5d4b68240..f93b4fa61 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ """Pytest fixtures for testing.""" + from typing import Any from typing import Dict diff --git a/tests/test_clientdb.py b/tests/test_clientdb.py index 2e95a4f4e..fc6529c83 100644 --- a/tests/test_clientdb.py +++ b/tests/test_clientdb.py @@ -1,4 +1,5 @@ """Unittests for ClientDatabases.""" + import json from operator import itemgetter from typing import Any diff --git a/tests/test_x_provider.py b/tests/test_x_provider.py index 80f54706a..b70fc1f32 100644 --- a/tests/test_x_provider.py +++ b/tests/test_x_provider.py @@ -512,9 +512,9 @@ def test_password_grant_type_ok(self): areq = ROPCAccessTokenRequest( grant_type="password", username="username", password="password" ) - areq[ - "client_id" - ] = "client1" # Token endpoint would fill that in based on client_authn + areq["client_id"] = ( + "client1" # Token endpoint would fill that in based on client_authn + ) resp = self.provider.password_grant_type(areq) atr = AccessTokenResponse().deserialize(resp.message, "json") @@ -527,9 +527,9 @@ def test_password_grant_type_no_authn(self): areq = ROPCAccessTokenRequest( grant_type="password", username="username", password="password" ) - areq[ - "client_id" - ] = "client1" # Token endpoint would fill that in based on client_authn + areq["client_id"] = ( + "client1" # Token endpoint would fill that in based on client_authn + ) resp = self.provider.password_grant_type(areq) atr = TokenErrorResponse().deserialize(resp.message, "json") @@ -542,9 +542,9 @@ def test_password_grant_type_bad(self): areq = ROPCAccessTokenRequest( grant_type="password", username="username", password="bad_password" ) - areq[ - "client_id" - ] = "client1" # Token endpoint would fill that in based on client_authn + areq["client_id"] = ( + "client1" # Token endpoint would fill that in based on client_authn + ) resp = self.provider.password_grant_type(areq) atr = TokenErrorResponse().deserialize(resp.message, "json")