Skip to content

Commit

Permalink
in [x, y, z]in (x, y, z)
Browse files Browse the repository at this point in the history
Suggested by refurb.
  • Loading branch information
DimitriPapadopoulos committed Sep 24, 2023
1 parent d0b3416 commit 1c81e56
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bench/compress_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
for in_, label in arrays:
print("\n*** %s ***" % label)
for codec in blosc2.Codec:
for filter in [
for filter in (
blosc2.Filter.NOFILTER,
blosc2.Filter.SHUFFLE,
blosc2.Filter.BITSHUFFLE,
]:
):
clevel = 6
t0 = time.time()
c = blosc2.compress(in_, in_.itemsize, clevel=clevel, filter=filter, codec=codec)
Expand Down
2 changes: 1 addition & 1 deletion tests/ndarray/test_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_copy(shape, chunks1, blocks1, chunks2, blocks2, dtype):
assert a.shape == b.shape
assert a.schunk.dparams == b.schunk.dparams
for key in cparams2.keys():
if key in ["filters", "filters_meta"]:
if key in ("filters", "filters_meta"):
assert b.schunk.cparams[key][: len(cparams2[key])] == cparams2[key]
continue
assert b.schunk.cparams[key] == cparams2[key]
Expand Down
4 changes: 2 additions & 2 deletions tests/ndarray/test_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_full(shape, chunks, blocks, fill_value, cparams, dparams, dtype, urlpat

b = np.full(shape=shape, fill_value=fill_value, dtype=a.dtype)
tol = 1e-5 if dtype is np.float32 else 1e-14
if dtype in [np.float32, np.float64]:
if dtype in (np.float32, np.float64):
np.testing.assert_allclose(a[...], b, rtol=tol, atol=tol)
else:
np.array_equal(a[...], b)
Expand All @@ -106,7 +106,7 @@ def test_full_simple(shape, fill_value, dtype):

b = np.full(shape=shape, fill_value=fill_value, dtype=a.dtype)
tol = 1e-5 if dtype is np.float32 else 1e-14
if dtype in [np.float32, np.float64]:
if dtype in (np.float32, np.float64):
np.testing.assert_allclose(a[...], b, rtol=tol, atol=tol)
else:
np.array_equal(a[...], b)
4 changes: 2 additions & 2 deletions tests/ndarray/test_lossy.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ def test_lossy(shape, cparams, dtype, urlpath, contiguous):
a = blosc2.asarray(array, cparams=cparams, urlpath=urlpath, contiguous=contiguous, mode="w")

if (
a.schunk.cparams["codec"] in [blosc2.Codec.ZFP_RATE, blosc2.Codec.ZFP_PREC, blosc2.Codec.ZFP_ACC]
a.schunk.cparams["codec"] in (blosc2.Codec.ZFP_RATE, blosc2.Codec.ZFP_PREC, blosc2.Codec.ZFP_ACC)
or a.schunk.cparams["filters"][0] == blosc2.Filter.NDMEAN
):
_ = a[...]
else:
tol = 1e-5
if dtype in [np.float32, np.float64]:
if dtype in (np.float32, np.float64):
np.testing.assert_allclose(a[...], array, rtol=tol, atol=tol)
else:
np.array_equal(a[...], array)
Expand Down

0 comments on commit 1c81e56

Please sign in to comment.