Enable ruff UP031 rule (#11388)

This commit is contained in:
Maxim Smolskiy 2024-04-30 07:40:26 +03:00 committed by GitHub
parent 3925b8155b
commit 2d6be5fbb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -150,7 +150,7 @@ def solve_all(grids, name="", showif=0.0):
display(grid_values(grid))
if values:
display(values)
print("(%.5f seconds)\n" % t)
print(f"({t:.5f} seconds)\n")
return (t, solved(values))
times, results = zip(*[time_solve(grid) for grid in grids])
@ -217,4 +217,4 @@ if __name__ == "__main__":
start = time.monotonic()
solve(puzzle)
t = time.monotonic() - start
print("Solved: %.5f sec" % t)
print(f"Solved: {t:.5f} sec")

View File

@ -156,7 +156,8 @@ class _DataSet:
self._rng = np.random.default_rng(seed1 if seed is None else seed2)
dtype = dtypes.as_dtype(dtype).base_dtype
if dtype not in (dtypes.uint8, dtypes.float32):
raise TypeError("Invalid image dtype %r, expected uint8 or float32" % dtype)
msg = f"Invalid image dtype {dtype!r}, expected uint8 or float32"
raise TypeError(msg)
if fake_data:
self._num_examples = 10000
self.one_hot = one_hot