mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Enable ruff UP031 rule (#11388)
This commit is contained in:
parent
3925b8155b
commit
2d6be5fbb0
|
@ -150,7 +150,7 @@ def solve_all(grids, name="", showif=0.0):
|
||||||
display(grid_values(grid))
|
display(grid_values(grid))
|
||||||
if values:
|
if values:
|
||||||
display(values)
|
display(values)
|
||||||
print("(%.5f seconds)\n" % t)
|
print(f"({t:.5f} seconds)\n")
|
||||||
return (t, solved(values))
|
return (t, solved(values))
|
||||||
|
|
||||||
times, results = zip(*[time_solve(grid) for grid in grids])
|
times, results = zip(*[time_solve(grid) for grid in grids])
|
||||||
|
@ -217,4 +217,4 @@ if __name__ == "__main__":
|
||||||
start = time.monotonic()
|
start = time.monotonic()
|
||||||
solve(puzzle)
|
solve(puzzle)
|
||||||
t = time.monotonic() - start
|
t = time.monotonic() - start
|
||||||
print("Solved: %.5f sec" % t)
|
print(f"Solved: {t:.5f} sec")
|
||||||
|
|
|
@ -156,7 +156,8 @@ class _DataSet:
|
||||||
self._rng = np.random.default_rng(seed1 if seed is None else seed2)
|
self._rng = np.random.default_rng(seed1 if seed is None else seed2)
|
||||||
dtype = dtypes.as_dtype(dtype).base_dtype
|
dtype = dtypes.as_dtype(dtype).base_dtype
|
||||||
if dtype not in (dtypes.uint8, dtypes.float32):
|
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:
|
if fake_data:
|
||||||
self._num_examples = 10000
|
self._num_examples = 10000
|
||||||
self.one_hot = one_hot
|
self.one_hot = one_hot
|
||||||
|
|
Loading…
Reference in New Issue
Block a user