Skip to content

Commit 2d6be5f

Browse files
Enable ruff UP031 rule (TheAlgorithms#11388)
1 parent 3925b81 commit 2d6be5f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Diff for: 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")

Diff for: 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)