Skip to content

Commit 1c19288

Browse files
committed
Fix linting from pre-commit
1 parent 478e705 commit 1c19288

File tree

7 files changed

+33
-14
lines changed

7 files changed

+33
-14
lines changed

jwt/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
register_algorithm,
2626
unregister_algorithm,
2727
)
28-
from .jwks_client import PyJWKClient
2928
from .exceptions import (
3029
DecodeError,
3130
ExpiredSignature,
@@ -40,8 +39,9 @@
4039
InvalidSignatureError,
4140
InvalidTokenError,
4241
MissingRequiredClaimError,
43-
PyJWTError,
42+
PyJWKClientError,
4443
PyJWKError,
4544
PyJWKSetError,
46-
PyJWKClientError,
45+
PyJWTError,
4746
)
47+
from .jwks_client import PyJWKClient

jwt/api_jwk.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ def __init__(self, jwk_data, algorithm=None):
1313
algorithm = self._jwk_data.get("alg", None)
1414

1515
if not algorithm:
16-
raise PyJWKError("Unable to find a algorithm for key: %s" % self._jwk_data)
16+
raise PyJWKError(
17+
"Unable to find a algorithm for key: %s" % self._jwk_data
18+
)
1719

1820
self.Algorithm = self._algorithms.get(algorithm)
1921

2022
if not self.Algorithm:
21-
raise PyJWKError("Unable to find a algorithm for key: %s" % self._jwk_data)
23+
raise PyJWKError(
24+
"Unable to find a algorithm for key: %s" % self._jwk_data
25+
)
2226

2327
self.key = self.Algorithm.from_jwk(self._jwk_data)
2428

jwt/api_jws.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def decode(
168168
return {
169169
"payload": payload,
170170
"header": header,
171-
"signature": signature
171+
"signature": signature,
172172
}
173173

174174
return payload

jwt/api_jwt.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ def decode(
101101
options.setdefault("verify_signature", verify)
102102

103103
decoded = super(PyJWT, self).decode(
104-
jwt, key=key, algorithms=algorithms, options=options, complete=complete, **kwargs
104+
jwt,
105+
key=key,
106+
algorithms=algorithms,
107+
options=options,
108+
complete=complete,
109+
**kwargs
105110
)
106111

107112
try:

jwt/jwks_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ def get_signing_keys(self):
3131
jwk_set = self.get_jwk_set()
3232
signing_keys = list(
3333
filter(
34-
lambda key: key.public_key_use == "sig" and key.key_id, jwk_set.keys,
34+
lambda key: key.public_key_use == "sig" and key.key_id,
35+
jwk_set.keys,
3536
)
3637
)
3738

3839
if len(signing_keys) == 0:
39-
raise PyJWKClientError("The JWKS endpoint did not contain any signing keys")
40+
raise PyJWKClientError(
41+
"The JWKS endpoint did not contain any signing keys"
42+
)
4043

4144
return signing_keys
4245

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ def get_version(package):
5454
license="MIT",
5555
keywords="jwt json web token security signing",
5656
url="https://github.com/jpadilla/pyjwt",
57-
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
57+
packages=find_packages(
58+
exclude=["*.tests", "*.tests.*", "tests.*", "tests"]
59+
),
5860
long_description=long_description,
5961
classifiers=[
6062
"Development Status :: 5 - Production/Stable",

tests/test_api_jwk.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
23
import pytest
34

45
from jwt.api_jwk import PyJWK, PyJWKSet
@@ -15,7 +16,8 @@
1516

1617
class TestPyJWK:
1718
@pytest.mark.skipif(
18-
not has_crypto, reason="Scenario requires cryptography to not be installed"
19+
not has_crypto,
20+
reason="Scenario requires cryptography to not be installed",
1921
)
2022
def test_should_load_key_from_jwk_data_dict(self):
2123
algo = RSAAlgorithm(RSAAlgorithm.SHA256)
@@ -38,7 +40,8 @@ def test_should_load_key_from_jwk_data_dict(self):
3840
assert jwk.public_key_use == "sig"
3941

4042
@pytest.mark.skipif(
41-
not has_crypto, reason="Scenario requires cryptography to not be installed"
43+
not has_crypto,
44+
reason="Scenario requires cryptography to not be installed",
4245
)
4346
def test_should_load_key_from_jwk_data_json_string(self):
4447
algo = RSAAlgorithm(RSAAlgorithm.SHA256)
@@ -63,7 +66,8 @@ def test_should_load_key_from_jwk_data_json_string(self):
6366

6467
class TestPyJWKSet:
6568
@pytest.mark.skipif(
66-
not has_crypto, reason="Scenario requires cryptography to not be installed"
69+
not has_crypto,
70+
reason="Scenario requires cryptography to not be installed",
6771
)
6872
def test_should_load_keys_from_jwk_data_dict(self):
6973
algo = RSAAlgorithm(RSAAlgorithm.SHA256)
@@ -87,7 +91,8 @@ def test_should_load_keys_from_jwk_data_dict(self):
8791
assert jwk.public_key_use == "sig"
8892

8993
@pytest.mark.skipif(
90-
not has_crypto, reason="Scenario requires cryptography to not be installed"
94+
not has_crypto,
95+
reason="Scenario requires cryptography to not be installed",
9196
)
9297
def test_should_load_keys_from_jwk_data_json_string(self):
9398
algo = RSAAlgorithm(RSAAlgorithm.SHA256)

0 commit comments

Comments
 (0)