summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>2023-02-07 16:09:41 +0600
committerGitHub <noreply@github.com>2023-02-07 16:09:41 +0600
commit9695f4c1d153ed8bf2b9ba0ef232c3a90889a1be (patch)
treed7daf13d579164bff77f3e3fb24fdd74b5adbdbb
parent1623dc843b6ae4f34b6ba120b8a5471d10ccfe0e (diff)
downloadpyjwt-9695f4c1d153ed8bf2b9ba0ef232c3a90889a1be.tar.gz
[pre-commit.ci] pre-commit autoupdate (#855)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 22.12.0 → 23.1.0](https://github.com/psf/black/compare/22.12.0...23.1.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
-rw-r--r--.pre-commit-config.yaml2
-rw-r--r--jwt/algorithms.py1
-rw-r--r--jwt/jwk_set_cache.py1
-rw-r--r--tests/test_algorithms.py6
-rw-r--r--tests/test_api_jwk.py10
-rw-r--r--tests/test_api_jws.py1
-rw-r--r--tests/test_api_jwt.py1
7 files changed, 4 insertions, 18 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4ec0cd9..ae4cca8 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
- rev: 22.12.0
+ rev: 23.1.0
hooks:
- id: black
args: ["--target-version=py37"]
diff --git a/jwt/algorithms.py b/jwt/algorithms.py
index 80d303c..277f940 100644
--- a/jwt/algorithms.py
+++ b/jwt/algorithms.py
@@ -475,7 +475,6 @@ if has_crypto:
@staticmethod
def to_jwk(key_obj):
-
if isinstance(key_obj, EllipticCurvePrivateKey):
public_numbers = key_obj.public_key().public_numbers()
elif isinstance(key_obj, EllipticCurvePublicKey):
diff --git a/jwt/jwk_set_cache.py b/jwt/jwk_set_cache.py
index 1b2465c..2432563 100644
--- a/jwt/jwk_set_cache.py
+++ b/jwt/jwk_set_cache.py
@@ -23,7 +23,6 @@ class JWKSetCache:
return self.jwk_set_with_timestamp.get_jwk_set()
def is_expired(self) -> bool:
-
return (
self.jwk_set_with_timestamp is not None
and self.lifespan > -1
diff --git a/tests/test_algorithms.py b/tests/test_algorithms.py
index 3ace425..1533b5d 100644
--- a/tests/test_algorithms.py
+++ b/tests/test_algorithms.py
@@ -169,7 +169,7 @@ class TestAlgorithms:
"P-521": ECAlgorithm.SHA512,
"secp256k1": ECAlgorithm.SHA256,
}
- for (curve, hash) in tests.items():
+ for curve, hash in tests.items():
algo = ECAlgorithm(hash)
with open(key_path(f"jwk_ec_pub_{curve}.json")) as keyfile:
@@ -236,7 +236,7 @@ class TestAlgorithms:
)
# EC private key length invalid
- for (curve, point) in valid_points.items():
+ for curve, point in valid_points.items():
with pytest.raises(InvalidKeyError):
algo.from_jwk(
f'{{"kty": "EC", "crv": "{curve}", "x": "{point["x"]}", "y": "{point["y"]}", "d": "dGVzdA=="}}'
@@ -318,7 +318,7 @@ class TestAlgorithms:
"P-521": ECAlgorithm.SHA512,
"secp256k1": ECAlgorithm.SHA256,
}
- for (curve, hash) in tests.items():
+ for curve, hash in tests.items():
algo = ECAlgorithm(hash)
with open(key_path(f"jwk_ec_pub_{curve}.json")) as keyfile:
diff --git a/tests/test_api_jwk.py b/tests/test_api_jwk.py
index f04f575..4754db6 100644
--- a/tests/test_api_jwk.py
+++ b/tests/test_api_jwk.py
@@ -57,7 +57,6 @@ class TestPyJWK:
@crypto_required
def test_should_load_key_without_alg_from_dict(self):
-
with open(key_path("jwk_rsa_pub.json")) as keyfile:
key_data = json.loads(keyfile.read())
@@ -69,7 +68,6 @@ class TestPyJWK:
@crypto_required
def test_should_load_key_from_dict_with_algorithm(self):
-
with open(key_path("jwk_rsa_pub.json")) as keyfile:
key_data = json.loads(keyfile.read())
@@ -81,7 +79,6 @@ class TestPyJWK:
@crypto_required
def test_should_load_key_ec_p256_from_dict(self):
-
with open(key_path("jwk_ec_pub_P-256.json")) as keyfile:
key_data = json.loads(keyfile.read())
@@ -93,7 +90,6 @@ class TestPyJWK:
@crypto_required
def test_should_load_key_ec_p384_from_dict(self):
-
with open(key_path("jwk_ec_pub_P-384.json")) as keyfile:
key_data = json.loads(keyfile.read())
@@ -105,7 +101,6 @@ class TestPyJWK:
@crypto_required
def test_should_load_key_ec_p521_from_dict(self):
-
with open(key_path("jwk_ec_pub_P-521.json")) as keyfile:
key_data = json.loads(keyfile.read())
@@ -117,7 +112,6 @@ class TestPyJWK:
@crypto_required
def test_should_load_key_ec_secp256k1_from_dict(self):
-
with open(key_path("jwk_ec_pub_secp256k1.json")) as keyfile:
key_data = json.loads(keyfile.read())
@@ -129,7 +123,6 @@ class TestPyJWK:
@crypto_required
def test_should_load_key_hmac_from_dict(self):
-
with open(key_path("jwk_hmac.json")) as keyfile:
key_data = json.loads(keyfile.read())
@@ -141,7 +134,6 @@ class TestPyJWK:
@crypto_required
def test_should_load_key_hmac_without_alg_from_dict(self):
-
with open(key_path("jwk_hmac.json")) as keyfile:
key_data = json.loads(keyfile.read())
@@ -154,7 +146,6 @@ class TestPyJWK:
@crypto_required
def test_should_load_key_okp_without_alg_from_dict(self):
-
with open(key_path("jwk_okp_pub_Ed25519.json")) as keyfile:
key_data = json.loads(keyfile.read())
@@ -165,7 +156,6 @@ class TestPyJWK:
@crypto_required
def test_from_dict_should_throw_exception_if_arg_is_invalid(self):
-
with open(key_path("jwk_rsa_pub.json")) as keyfile:
valid_rsa_pub = json.loads(keyfile.read())
with open(key_path("jwk_ec_pub_P-256.json")) as keyfile:
diff --git a/tests/test_api_jws.py b/tests/test_api_jws.py
index fe6c2d4..2929215 100644
--- a/tests/test_api_jws.py
+++ b/tests/test_api_jws.py
@@ -158,7 +158,6 @@ class TestJWS:
assert str(exception) == "Invalid header string: must be a json object"
def test_encode_algorithm_param_should_be_case_sensitive(self, jws, payload):
-
jws.encode(payload, "secret", algorithm="HS256")
with pytest.raises(NotImplementedError) as context:
diff --git a/tests/test_api_jwt.py b/tests/test_api_jwt.py
index 24ed240..3c08ea5 100644
--- a/tests/test_api_jwt.py
+++ b/tests/test_api_jwt.py
@@ -160,7 +160,6 @@ class TestJWT:
assert str(exception) == "Invalid claim format in token"
def test_encode_bad_type(self, jwt):
-
types = ["string", tuple(), list(), 42, set()]
for t in types: