Skip to content

Commit 87758e5

Browse files
committed
ruff format with latest version
1 parent 908a74d commit 87758e5

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- uses: astral-sh/ruff-action@v3
1515
with:
16+
version: "latest"
1617
args: "check"
1718

1819
lint_format_ruff:
@@ -21,6 +22,7 @@ jobs:
2122
- uses: actions/checkout@v4
2223
- uses: astral-sh/ruff-action@v3
2324
with:
25+
version: "latest"
2426
args: "format --check"
2527

2628
test:

benchmarks/benchmark_dilithium.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ def benchmark_dilithium(Dilithium, name, count):
6060
fails += 1
6161

6262
print(f"Keygen median: {round(median(keygen_times), 3)}")
63-
print(f"Sign median: {round(median(sign_times),3)}")
64-
print(f"Sign average: {round(mean(sign_times),3)}")
65-
print(f"Verify median: {round(median(verify_times),3)}")
63+
print(f"Sign median: {round(median(sign_times), 3)}")
64+
print(f"Sign average: {round(mean(sign_times), 3)}")
65+
print(f"Verify median: {round(median(verify_times), 3)}")
6666
print(f"Fails: {fails}")
6767

6868

benchmarks/benchmark_ml_dsa.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ def benchmark_ml_dsa(ML_DSA, name, count):
6060
fails += 1
6161

6262
print(f"Keygen median: {round(median(keygen_times), 3)}")
63-
print(f"Sign median: {round(median(sign_times),3)}")
64-
print(f"Sign average: {round(mean(sign_times),3)}")
65-
print(f"Verify median: {round(median(verify_times),3)}")
63+
print(f"Sign median: {round(median(sign_times), 3)}")
64+
print(f"Sign average: {round(mean(sign_times), 3)}")
65+
print(f"Verify median: {round(median(verify_times), 3)}")
6666
print(f"Fails: {fails}")
6767

6868

src/dilithium_py/polynomials/polynomials.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ def bit_unpack_w(self, input_bytes, gamma_2):
199199
coefficients = self.__bit_unpack(input_bytes, 6)
200200
# Level 3 and 5 parameter set
201201
else:
202-
assert (
203-
gamma_2 == 261888
204-
), f"Expected gamma_2 to be either (q-1)/88 or (q-1)/32, got {gamma_2 = }"
202+
assert gamma_2 == 261888, (
203+
f"Expected gamma_2 to be either (q-1)/88 or (q-1)/32, got {gamma_2 = }"
204+
)
205205
coefficients = self.__bit_unpack(input_bytes, 4)
206206

207207
return self(coefficients)
@@ -212,9 +212,9 @@ def bit_unpack_z(self, input_bytes, gamma_1):
212212
altered_coeffs = self.__bit_unpack(input_bytes, 18)
213213
# Level 3 and 5 parameter set
214214
else:
215-
assert gamma_1 == (
216-
1 << 19
217-
), f"Expected gamma_1 to be either 2^17 or 2^19, got {gamma_1 = }"
215+
assert gamma_1 == (1 << 19), (
216+
f"Expected gamma_1 to be either 2^17 or 2^19, got {gamma_1 = }"
217+
)
218218
altered_coeffs = self.__bit_unpack(input_bytes, 20)
219219

220220
coefficients = [gamma_1 - c for c in altered_coeffs]
@@ -350,9 +350,9 @@ def bit_pack_w(self, gamma_2):
350350
if gamma_2 == 95232:
351351
return self.__bit_pack(self.coeffs, 6, 192)
352352
# Level 3 and 5 parameter set
353-
assert (
354-
gamma_2 == 261888
355-
), f"Expected gamma_2 to be either (q-1)/88 or (q-1)/32, got {gamma_2 = }"
353+
assert gamma_2 == 261888, (
354+
f"Expected gamma_2 to be either (q-1)/88 or (q-1)/32, got {gamma_2 = }"
355+
)
356356
return self.__bit_pack(self.coeffs, 4, 128)
357357

358358
def bit_pack_z(self, gamma_1):
@@ -361,9 +361,9 @@ def bit_pack_z(self, gamma_1):
361361
if gamma_1 == (1 << 17):
362362
return self.__bit_pack(altered_coeffs, 18, 576)
363363
# Level 3 and 5 parameter set
364-
assert gamma_1 == (
365-
1 << 19
366-
), f"Expected gamma_1 to be either 2^17 or 2^19, got: {gamma_1 = }"
364+
assert gamma_1 == (1 << 19), (
365+
f"Expected gamma_1 to be either 2^17 or 2^19, got: {gamma_1 = }"
366+
)
367367
return self.__bit_pack(altered_coeffs, 20, 640)
368368

369369
def make_hint(self, other, alpha):

0 commit comments

Comments
 (0)