Skip to content

Commit 34db3c5

Browse files
committed
Enable ruff UP031 rule
1 parent 3925b81 commit 34db3c5

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ repos:
1111
- id: requirements-txt-fixer
1212

1313
- repo: https://github.com/MarcoGorelli/auto-walrus
14-
rev: 0.3.3
14+
rev: 0.3.4
1515
hooks:
1616
- id: auto-walrus
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.4.1
19+
rev: v0.4.2
2020
hooks:
2121
- id: ruff
2222
- id: ruff-format
@@ -47,7 +47,7 @@ repos:
4747
- id: validate-pyproject
4848

4949
- repo: https://github.com/pre-commit/mirrors-mypy
50-
rev: v1.9.0
50+
rev: v1.10.0
5151
hooks:
5252
- id: mypy
5353
args:

data_structures/arrays/sudoku_solver.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def time_solve(grid):
150150
display(grid_values(grid))
151151
if values:
152152
display(values)
153-
print("(%.5f seconds)\n" % t)
153+
print(f"({t:.5f} seconds)\n")
154154
return (t, solved(values))
155155

156156
times, results = zip(*[time_solve(grid) for grid in grids])
@@ -217,4 +217,4 @@ def shuffled(seq):
217217
start = time.monotonic()
218218
solve(puzzle)
219219
t = time.monotonic() - start
220-
print("Solved: %.5f sec" % t)
220+
print(f"Solved: {t:.5f} sec")

neural_network/input_data.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ def __init__(
156156
self._rng = np.random.default_rng(seed1 if seed is None else seed2)
157157
dtype = dtypes.as_dtype(dtype).base_dtype
158158
if dtype not in (dtypes.uint8, dtypes.float32):
159-
raise TypeError("Invalid image dtype %r, expected uint8 or float32" % dtype)
159+
msg = f"Invalid image dtype {dtype!r}, expected uint8 or float32"
160+
raise TypeError(msg)
160161
if fake_data:
161162
self._num_examples = 10000
162163
self.one_hot = one_hot

0 commit comments

Comments
 (0)