Skip to content

Commit f541302

Browse files
committed
style: apply Ruff formatting
1 parent 801cd12 commit f541302

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

‎jwt/algorithms.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,15 +393,16 @@ def prepare_key(self, key: str | bytes) -> bytes:
393393
if end >= len(decoded_key):
394394
break
395395
next_index = end + 1
396-
while next_index < len(decoded_key) and decoded_key[
397-
next_index
398-
] in " \t\r\n":
396+
while (
397+
next_index < len(decoded_key)
398+
and decoded_key[next_index] in " \t\r\n"
399+
):
399400
next_index += 1
400401
if next_index < len(decoded_key) and decoded_key[next_index] == ":":
401402
try:
402-
has_jwk_member = json.loads(
403-
decoded_key[index : end + 1]
404-
) == "kty"
403+
has_jwk_member = (
404+
json.loads(decoded_key[index : end + 1]) == "kty"
405+
)
405406
except ValueError:
406407
pass
407408
if has_jwk_member:

‎tests/test_algorithms.py‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,7 @@ def test_hmac_prepare_key_rejects_jwk_json(self, jwk_file: str) -> None:
200200
with pytest.raises(InvalidKeyError, match="looks like a JWK"):
201201
algo.prepare_key(keyfile.read())
202202

203-
@pytest.mark.parametrize(
204-
"container", ("jwks", "array", "nested-array", "bom-jwks")
205-
)
203+
@pytest.mark.parametrize("container", ("jwks", "array", "nested-array", "bom-jwks"))
206204
def test_hmac_prepare_key_rejects_public_jwk_containers(
207205
self, container: str
208206
) -> None:
@@ -218,9 +216,7 @@ def test_hmac_prepare_key_rejects_public_jwk_containers(
218216
elif container == "nested-array":
219217
key = json.dumps([[public_jwk]])
220218
else:
221-
key = b"\xef\xbb\xbf" + json.dumps(
222-
{"keys": [public_jwk]}
223-
).encode()
219+
key = b"\xef\xbb\xbf" + json.dumps({"keys": [public_jwk]}).encode()
224220

225221
with pytest.raises(InvalidKeyError, match="looks like a JWK"):
226222
algo.prepare_key(key)

0 commit comments

Comments
 (0)