Skip to content

Commit 5fca1e2

Browse files
committed
Ran black and isort.
1 parent fa52186 commit 5fca1e2

File tree

88 files changed

+836
-865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+836
-865
lines changed

src/idpyoidc/claims.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def handle_keys(self, configuration: dict, keyjar: Optional[KeyJar] = None):
155155
return {"keyjar": keyjar, "jwks": _jwks, "jwks_uri": _jwks_uri}
156156

157157
def load_conf(
158-
self, configuration: dict, supports: dict, keyjar: Optional[KeyJar] = None
158+
self, configuration: dict, supports: dict, keyjar: Optional[KeyJar] = None
159159
) -> KeyJar:
160160
for attr, val in configuration.items():
161161
if attr in ["preference", "capabilities"]:
@@ -212,4 +212,3 @@ def get_claim(self, key, default=None):
212212
return default
213213
else:
214214
return _val
215-

src/idpyoidc/client/claims/oidc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ def __init__(self, prefer: Optional[dict] = None, callback_path: Optional[dict]
9595

9696
def verify_rules(self, supports):
9797
if self.get_preference("request_parameter_supported") and self.get_preference(
98-
"request_uri_parameter_supported"
98+
"request_uri_parameter_supported"
9999
):
100100
raise ValueError(
101101
"You have to chose one of 'request_parameter_supported' and "
102102
"'request_uri_parameter_supported'. You can't have both."
103103
)
104104

105105
if self.get_preference("request_parameter_supported") or self.get_preference(
106-
"request_uri_parameter_supported"
106+
"request_uri_parameter_supported"
107107
):
108108
if not self.get_preference("request_object_signing_alg_values_supported"):
109109
self.set_preference(

src/idpyoidc/client/client_auth.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212

1313
from idpyoidc.defaults import DEF_SIGN_ALG
1414
from idpyoidc.defaults import JWT_BEARER
15-
from idpyoidc.message.oauth2 import AccessTokenRequest
1615
from idpyoidc.message.oauth2 import SINGLE_OPTIONAL_STRING
16+
from idpyoidc.message.oauth2 import AccessTokenRequest
1717
from idpyoidc.message.oidc import AuthnToken
1818
from idpyoidc.time_util import utc_time_sans_frac
1919
from idpyoidc.util import rndstr
20-
from .util import sanitize
20+
2121
from ..message import VREQUIRED
2222
from ..util import instantiate
23+
from .util import sanitize
2324

2425
# from idpyoidc.oidc.backchannel_authentication import ClientNotificationAuthn
2526

src/idpyoidc/client/configure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from idpyoidc.configure import Base
99
from idpyoidc.logging import configure_logging
10+
1011
from .util import lower_or_upper
1112

1213
try:

src/idpyoidc/client/entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def __init__(
141141
keyjar=self.keyjar,
142142
upstream_get=self.unit_get,
143143
client_type=client_type,
144-
entity_id=self.entity_id
144+
entity_id=self.entity_id,
145145
)
146146

147147
self.setup_client_authn_methods(config)

src/idpyoidc/client/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
from http.cookies import CookieError
55
from http.cookies import SimpleCookie
66

7-
from requests import request
87
from idpyoidc.client.exception import NonFatalException
98
from idpyoidc.client.util import sanitize
109
from idpyoidc.client.util import set_cookie
10+
from requests import request
1111

1212
__author__ = "roland"
1313

src/idpyoidc/client/oauth2/__init__.py

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
from typing import Union
66

77
from cryptojwt.key_jar import KeyJar
8-
from requests import request
98

109
from idpyoidc.client.entity import Entity
1110
from idpyoidc.client.exception import ConfigurationError
1211
from idpyoidc.client.exception import OidcServiceError
1312
from idpyoidc.client.exception import ParseError
1413
from idpyoidc.client.service import REQUEST_INFO
15-
from idpyoidc.client.service import Service
1614
from idpyoidc.client.service import SUCCESSFUL
15+
from idpyoidc.client.service import Service
1716
from idpyoidc.client.util import do_add_ons
1817
from idpyoidc.client.util import get_deserialization_method
1918
from idpyoidc.configure import Configuration
2019
from idpyoidc.context import OidcContext
2120
from idpyoidc.exception import FormatError
2221
from idpyoidc.message import Message
2322
from idpyoidc.message.oauth2 import is_error_message
23+
from requests import request
2424

2525
__author__ = "Roland Hedberg"
2626

@@ -38,20 +38,20 @@ class Client(Entity):
3838
client_type = "oauth2"
3939

4040
def __init__(
41-
self,
42-
keyjar: Optional[KeyJar] = None,
43-
config: Optional[Union[dict, Configuration]] = None,
44-
services: Optional[dict] = None,
45-
httpc: Optional[Callable] = None,
46-
httpc_params: Optional[dict] = None,
47-
context: Optional[OidcContext] = None,
48-
upstream_get: Optional[Callable] = None,
49-
key_conf: Optional[dict] = None,
50-
entity_id: Optional[str] = "",
51-
verify_ssl: Optional[bool] = True,
52-
jwks_uri: Optional[str] = "",
53-
client_type: Optional[str] = "",
54-
**kwargs
41+
self,
42+
keyjar: Optional[KeyJar] = None,
43+
config: Optional[Union[dict, Configuration]] = None,
44+
services: Optional[dict] = None,
45+
httpc: Optional[Callable] = None,
46+
httpc_params: Optional[dict] = None,
47+
context: Optional[OidcContext] = None,
48+
upstream_get: Optional[Callable] = None,
49+
key_conf: Optional[dict] = None,
50+
entity_id: Optional[str] = "",
51+
verify_ssl: Optional[bool] = True,
52+
jwks_uri: Optional[str] = "",
53+
client_type: Optional[str] = "",
54+
**kwargs
5555
):
5656
"""
5757
@@ -73,7 +73,7 @@ def __init__(
7373

7474
if client_type:
7575
self.client_type = client_type
76-
elif config and 'client_type' in config:
76+
elif config and "client_type" in config:
7777
client_type = self.client_type = config["client_type"]
7878
else:
7979
client_type = self.client_type
@@ -85,7 +85,7 @@ def __init__(
8585
else:
8686
httpc_params = {"verify": False}
8787

88-
jwks_uri = jwks_uri or config.get('jwks_uri', '')
88+
jwks_uri = jwks_uri or config.get("jwks_uri", "")
8989

9090
Entity.__init__(
9191
self,
@@ -113,12 +113,12 @@ def __init__(
113113
do_add_ons(_add_ons, self._service)
114114

115115
def do_request(
116-
self,
117-
request_type: str,
118-
response_body_type: Optional[str] = "",
119-
request_args: Optional[dict] = None,
120-
behaviour_args: Optional[dict] = None,
121-
**kwargs
116+
self,
117+
request_type: str,
118+
response_body_type: Optional[str] = "",
119+
request_args: Optional[dict] = None,
120+
behaviour_args: Optional[dict] = None,
121+
**kwargs
122122
):
123123
_srv = self._service[request_type]
124124

@@ -141,14 +141,14 @@ def set_client_id(self, client_id):
141141
self.get_context().set("client_id", client_id)
142142

143143
def get_response(
144-
self,
145-
service: Service,
146-
url: str,
147-
method: Optional[str] = "GET",
148-
body: Optional[dict] = None,
149-
response_body_type: Optional[str] = "",
150-
headers: Optional[dict] = None,
151-
**kwargs
144+
self,
145+
service: Service,
146+
url: str,
147+
method: Optional[str] = "GET",
148+
body: Optional[dict] = None,
149+
response_body_type: Optional[str] = "",
150+
headers: Optional[dict] = None,
151+
**kwargs
152152
):
153153
"""
154154
@@ -184,14 +184,14 @@ def get_response(
184184
return self.parse_request_response(service, resp, response_body_type, **kwargs)
185185

186186
def service_request(
187-
self,
188-
service: Service,
189-
url: str,
190-
method: Optional[str] = "GET",
191-
body: Optional[dict] = None,
192-
response_body_type: Optional[str] = "",
193-
headers: Optional[dict] = None,
194-
**kwargs
187+
self,
188+
service: Service,
189+
url: str,
190+
method: Optional[str] = "GET",
191+
body: Optional[dict] = None,
192+
response_body_type: Optional[str] = "",
193+
headers: Optional[dict] = None,
194+
**kwargs
195195
) -> Message:
196196
"""
197197
The method that sends the request and handles the response returned.
@@ -320,10 +320,10 @@ def dynamic_provider_info_discovery(client: Client, behaviour_args: Optional[dic
320320
:param client: A :py:class:`idpyoidc.client.oidc.Client` instance
321321
"""
322322

323-
if client.client_type == 'oidc' and client.get_service("provider_info"):
324-
service = 'provider_info'
325-
elif client.client_type == 'oauth2' and client.get_service('server_metadata'):
326-
service = 'server_metadata'
323+
if client.client_type == "oidc" and client.get_service("provider_info"):
324+
service = "provider_info"
325+
elif client.client_type == "oauth2" and client.get_service("server_metadata"):
326+
service = "server_metadata"
327327
else:
328328
raise ConfigurationError("Can not do dynamic provider info discovery")
329329

src/idpyoidc/client/oauth2/access_token.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from idpyoidc.client.service import Service
88
from idpyoidc.message import oauth2
99
from idpyoidc.message.oauth2 import ResponseMessage
10-
from idpyoidc.time_util import time_sans_frac
1110
from idpyoidc.metadata import get_signing_algs
11+
from idpyoidc.time_util import time_sans_frac
1212

1313
LOGGER = logging.getLogger(__name__)
1414

src/idpyoidc/client/oauth2/add_on/dpop.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
from typing import Optional
55

66
from cryptojwt.jwk.jwk import key_from_jwk_dict
7-
from cryptojwt.jws.jws import factory
87
from cryptojwt.jws.jws import JWS
8+
from cryptojwt.jws.jws import factory
99
from cryptojwt.key_bundle import key_by_alg
1010

1111
from idpyoidc.client.service_context import ServiceContext
12-
from idpyoidc.message import Message
1312
from idpyoidc.message import SINGLE_OPTIONAL_STRING
1413
from idpyoidc.message import SINGLE_REQUIRED_INT
1514
from idpyoidc.message import SINGLE_REQUIRED_JSON
1615
from idpyoidc.message import SINGLE_REQUIRED_STRING
16+
from idpyoidc.message import Message
1717
from idpyoidc.metadata import get_signing_algs
1818
from idpyoidc.time_util import utc_time_sans_frac
1919

@@ -91,13 +91,13 @@ def verify_header(self, dpop_header) -> Optional["DPoPProof"]:
9191

9292

9393
def dpop_header(
94-
service_context: ServiceContext,
95-
service_endpoint: str,
96-
http_method: str,
97-
headers: Optional[dict] = None,
98-
token: Optional[str] = "",
99-
nonce: Optional[str] = "",
100-
**kwargs
94+
service_context: ServiceContext,
95+
service_endpoint: str,
96+
http_method: str,
97+
headers: Optional[dict] = None,
98+
token: Optional[str] = "",
99+
nonce: Optional[str] = "",
100+
**kwargs
101101
) -> dict:
102102
"""
103103

src/idpyoidc/client/oauth2/add_on/jar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import logging
22
from typing import Optional
33

4-
from idpyoidc import metadata
5-
64
from idpyoidc import claims
5+
from idpyoidc import metadata
76
from idpyoidc.client.oidc.utils import construct_request_uri
87
from idpyoidc.client.oidc.utils import request_object_encryption
98
from idpyoidc.message.oidc import make_openid_request

0 commit comments

Comments
 (0)