Skip to content

Commit 4c8aa4e

Browse files
authored
Bump to ruff 0.9 (#12259)
1 parent 92f3693 commit 4c8aa4e

File tree

12 files changed

+33
-66
lines changed

12 files changed

+33
-66
lines changed

ci-constraints-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ requests==2.32.3 ; python_full_version >= '3.8'
204204
# via
205205
# sphinx
206206
# sphinxcontrib-spelling
207-
ruff==0.8.6
207+
ruff==0.9.0
208208
# via cryptography (pyproject.toml)
209209
six==1.17.0 ; python_full_version < '3.8'
210210
# via bleach

src/cryptography/hazmat/primitives/_serialization.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ def key_cert_algorithm(
126126
) -> KeySerializationEncryptionBuilder:
127127
if self._format is not PrivateFormat.PKCS12:
128128
raise TypeError(
129-
"key_cert_algorithm only supported with "
130-
"PrivateFormat.PKCS12"
129+
"key_cert_algorithm only supported with PrivateFormat.PKCS12"
131130
)
132131
if self._key_cert_algorithm is not None:
133132
raise ValueError("key_cert_algorithm already set")

src/cryptography/hazmat/primitives/twofactor/hotp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _dynamic_truncate(self, counter: int) -> int:
8484
try:
8585
ctx.update(counter.to_bytes(length=8, byteorder="big"))
8686
except OverflowError:
87-
raise ValueError(f"Counter must be between 0 and {2 ** 64 - 1}.")
87+
raise ValueError(f"Counter must be between 0 and {2**64 - 1}.")
8888

8989
hmac_value = ctx.finalize()
9090

src/cryptography/x509/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,7 @@ def not_valid_after(self, time: datetime.datetime) -> CertificateBuilder:
511511
time = _convert_to_naive_utc_time(time)
512512
if time < _EARLIEST_UTC_TIME:
513513
raise ValueError(
514-
"The not valid after date must be on or after"
515-
" 1950 January 1."
514+
"The not valid after date must be on or after 1950 January 1."
516515
)
517516
if (
518517
self._not_valid_before is not None

src/cryptography/x509/extensions.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,7 @@ def path_length(self) -> int | None:
451451

452452
def __repr__(self) -> str:
453453
return (
454-
f"<BasicConstraints(ca={self.ca}, "
455-
f"path_length={self.path_length})>"
454+
f"<BasicConstraints(ca={self.ca}, path_length={self.path_length})>"
456455
)
457456

458457
def __eq__(self, other: object) -> bool:
@@ -823,8 +822,7 @@ def __init__(self, policies: Iterable[PolicyInformation]) -> None:
823822
policies = list(policies)
824823
if not all(isinstance(x, PolicyInformation) for x in policies):
825824
raise TypeError(
826-
"Every item in the policies list must be a "
827-
"PolicyInformation"
825+
"Every item in the policies list must be a PolicyInformation"
828826
)
829827

830828
self._policies = policies
@@ -2450,10 +2448,7 @@ def value(self) -> bytes:
24502448
return self._value
24512449

24522450
def __repr__(self) -> str:
2453-
return (
2454-
f"<UnrecognizedExtension(oid={self.oid}, "
2455-
f"value={self.value!r})>"
2456-
)
2451+
return f"<UnrecognizedExtension(oid={self.oid}, value={self.value!r})>"
24572452

24582453
def __eq__(self, other: object) -> bool:
24592454
if not isinstance(other, UnrecognizedExtension):

src/cryptography/x509/ocsp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ def __init__(
109109
revocation_time = _convert_to_naive_utc_time(revocation_time)
110110
if revocation_time < _EARLIEST_UTC_TIME:
111111
raise ValueError(
112-
"The revocation_time must be on or after"
113-
" 1950 January 1."
112+
"The revocation_time must be on or after 1950 January 1."
114113
)
115114

116115
if revocation_reason is not None and not isinstance(

tests/hazmat/primitives/fixtures_ec.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@
250250

251251
EC_KEY_SECP224R1 = ec.EllipticCurvePrivateNumbers(
252252
private_value=int(
253-
"234854340492774342642505519082413233282383066880756900834047566251"
254-
"50"
253+
"23485434049277434264250551908241323328238306688075690083404756625150"
255254
),
256255
public_numbers=ec.EllipticCurvePublicNumbers(
257256
curve=ec.SECP224R1(),

tests/hazmat/primitives/test_concatkdf.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ def test_derive(self, backend):
147147
)
148148

149149
okm = binascii.unhexlify(
150-
b"64ce901db10d558661f10b6836a122a7"
151-
b"605323ce2f39bf27eaaac8b34cf89f2f"
150+
b"64ce901db10d558661f10b6836a122a7605323ce2f39bf27eaaac8b34cf89f2f"
152151
)
153152

154153
oinfo = binascii.unhexlify(
@@ -168,8 +167,7 @@ def test_buffer_protocol(self, backend):
168167
)
169168

170169
okm = binascii.unhexlify(
171-
b"64ce901db10d558661f10b6836a122a7"
172-
b"605323ce2f39bf27eaaac8b34cf89f2f"
170+
b"64ce901db10d558661f10b6836a122a7605323ce2f39bf27eaaac8b34cf89f2f"
173171
)
174172

175173
oinfo = binascii.unhexlify(
@@ -189,8 +187,7 @@ def test_derive_explicit_salt(self, backend):
189187
)
190188

191189
okm = binascii.unhexlify(
192-
b"64ce901db10d558661f10b6836a122a7"
193-
b"605323ce2f39bf27eaaac8b34cf89f2f"
190+
b"64ce901db10d558661f10b6836a122a7605323ce2f39bf27eaaac8b34cf89f2f"
194191
)
195192

196193
oinfo = binascii.unhexlify(
@@ -212,8 +209,7 @@ def test_verify(self, backend):
212209
)
213210

214211
okm = binascii.unhexlify(
215-
b"64ce901db10d558661f10b6836a122a7"
216-
b"605323ce2f39bf27eaaac8b34cf89f2f"
212+
b"64ce901db10d558661f10b6836a122a7605323ce2f39bf27eaaac8b34cf89f2f"
217213
)
218214

219215
oinfo = binascii.unhexlify(

tests/hazmat/primitives/test_poly1305.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ def test_invalid_key_length(self, backend):
133133

134134
def test_buffer_protocol(self, backend):
135135
key = binascii.unhexlify(
136-
b"1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cb"
137-
b"c207075c0"
136+
b"1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cbc207075c0"
138137
)
139138
msg = binascii.unhexlify(
140139
b"2754776173206272696c6c69672c20616e642074686520736c69746"

tests/hazmat/primitives/test_x25519.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,10 @@ def test_rfc7748(self, vector, backend):
6262

6363
def test_rfc7748_1000_iteration(self, backend):
6464
old_private = private = public = binascii.unhexlify(
65-
b"090000000000000000000000000000000000000000000000000000000000"
66-
b"0000"
65+
b"0900000000000000000000000000000000000000000000000000000000000000"
6766
)
6867
shared_key = binascii.unhexlify(
69-
b"684cf59ba83309552800ef566f2f4d3c1c3887c49360e3875f2eb94d9953"
70-
b"2c51"
68+
b"684cf59ba83309552800ef566f2f4d3c1c3887c49360e3875f2eb94d99532c51"
7169
)
7270
private_key = X25519PrivateKey.from_private_bytes(private)
7371
public_key = X25519PublicKey.from_public_bytes(public)

0 commit comments

Comments
 (0)