diff --git a/examples/btune.py b/examples/btune.py index 226553ed..994d27d0 100644 --- a/examples/btune.py +++ b/examples/btune.py @@ -11,10 +11,11 @@ # https://github.com/Blosc/blosc2_btune/blob/main/README.md ####################################################################### -import blosc2 import blosc2_btune import numpy as np +import blosc2 + nchunks = 10 # Set the compression and decompression parameters, use BTUNE tuner cparams = blosc2.CParams(codec=blosc2.Codec.LZ4HC, typesize=4, tuner=blosc2.Tuner.BTUNE) diff --git a/examples/compress2_decompress2.py b/examples/compress2_decompress2.py index a84134b3..996c251d 100644 --- a/examples/compress2_decompress2.py +++ b/examples/compress2_decompress2.py @@ -6,9 +6,10 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np +import blosc2 + a = np.linspace(0, 1, 1_000_000, dtype=np.float64) typesize = a.dtype.itemsize c_bytesobj = blosc2.compress2( diff --git a/examples/filler.py b/examples/filler.py index e58524a7..bfd1c1a2 100644 --- a/examples/filler.py +++ b/examples/filler.py @@ -8,9 +8,10 @@ # Fill an SChunk with a filler decorator -import blosc2 import numpy as np +import blosc2 + nchunks = 3 chunk_len = 200 * 1000 schunk_dtype = np.dtype(np.float64) diff --git a/examples/mmap-rw.py b/examples/mmap-rw.py index c8caefb9..f9b8bd7f 100644 --- a/examples/mmap-rw.py +++ b/examples/mmap-rw.py @@ -9,9 +9,10 @@ # Example for writing and reading memory-mapped files -import blosc2 import numpy as np +import blosc2 + urlpath = "array.b2nd" blosc2.remove_urlpath(urlpath) a = np.arange(1_000_000, dtype=np.int64) diff --git a/examples/ndarray/asarray_.py b/examples/ndarray/asarray_.py index 0cc75844..f2f74ae2 100644 --- a/examples/ndarray/asarray_.py +++ b/examples/ndarray/asarray_.py @@ -8,9 +8,10 @@ # Import structured arrays using the array interface -import blosc2 import numpy as np +import blosc2 + shape = (2, 2) dtype = np.float64 diff --git a/examples/ndarray/broadcast_expr.py b/examples/ndarray/broadcast_expr.py index 243fa3d3..b60d21d2 100644 --- a/examples/ndarray/broadcast_expr.py +++ b/examples/ndarray/broadcast_expr.py @@ -9,9 +9,10 @@ # This shows how to evaluate expressions with NDArray instances having different shapes as operands. # The broadcast is done internally and tries to mimic NumPy behavior. -import blosc2 import numpy as np +import blosc2 + # Two operands with the next shapes should be supported # shape1, shape2 = (2, 1, 3, 2), (3, 3, 2) # shape1, shape2 = (2, 1, 3, 2), (3, 1, 2) diff --git a/examples/ndarray/buffer.py b/examples/ndarray/buffer.py index 86d00234..773a9d96 100644 --- a/examples/ndarray/buffer.py +++ b/examples/ndarray/buffer.py @@ -8,9 +8,10 @@ # Creating/dumping an NDArray from/to a buffer -import blosc2 import numpy as np +import blosc2 + shape = (50, 50) chunks = (49, 49) dtype = np.dtype("|S8") diff --git a/examples/ndarray/bytedelta_filter.py b/examples/ndarray/bytedelta_filter.py index 80821b70..17fa2848 100644 --- a/examples/ndarray/bytedelta_filter.py +++ b/examples/ndarray/bytedelta_filter.py @@ -11,9 +11,10 @@ import math -import blosc2 import numpy as np +import blosc2 + shape = (1000, 1000) # Create a buffer diff --git a/examples/ndarray/c2array_expr.py b/examples/ndarray/c2array_expr.py index d51d270a..b6369e4a 100644 --- a/examples/ndarray/c2array_expr.py +++ b/examples/ndarray/c2array_expr.py @@ -1,8 +1,9 @@ import pathlib -import blosc2 import numpy as np +import blosc2 + host = "https://demo.caterva2.net/" root = "b2tests" dir = "expr/" diff --git a/examples/ndarray/compute_expr.py b/examples/ndarray/compute_expr.py index 30d0520c..ce3f25bb 100644 --- a/examples/ndarray/compute_expr.py +++ b/examples/ndarray/compute_expr.py @@ -8,9 +8,10 @@ # This shows how to evaluate expressions with NDArray instances as operands. -import blosc2 import numpy as np +import blosc2 + shape = (50, 50) # Create a NDArray from a NumPy array diff --git a/examples/ndarray/compute_fields.py b/examples/ndarray/compute_fields.py index 991f8708..6a706ce3 100644 --- a/examples/ndarray/compute_fields.py +++ b/examples/ndarray/compute_fields.py @@ -8,9 +8,10 @@ # This shows how to evaluate expressions with NDField instances as operands. -import blosc2 import numpy as np +import blosc2 + shape = (50, 50) # Create a structured NumPy array diff --git a/examples/ndarray/compute_udf_numba.py b/examples/ndarray/compute_udf_numba.py index 36b169cc..1db953d1 100644 --- a/examples/ndarray/compute_udf_numba.py +++ b/examples/ndarray/compute_udf_numba.py @@ -8,10 +8,11 @@ # This shows how to evaluate expressions with NDArray instances as operands. -import blosc2 import numba as nb import numpy as np +import blosc2 + # The UDF to be evaluated @nb.jit(nopython=True, parallel=True) diff --git a/examples/ndarray/compute_where.py b/examples/ndarray/compute_where.py index fed936a9..642ddcf2 100644 --- a/examples/ndarray/compute_where.py +++ b/examples/ndarray/compute_where.py @@ -8,9 +8,10 @@ # This shows how to evaluate expressions in combination with the where() functionality. -import blosc2 import numpy as np +import blosc2 + shape = (50, 50) chunks = (10, 10) blocks = (5, 5) diff --git a/examples/ndarray/copy_.py b/examples/ndarray/copy_.py index 1c99e966..b31c4a6d 100644 --- a/examples/ndarray/copy_.py +++ b/examples/ndarray/copy_.py @@ -8,9 +8,10 @@ # Copying NDArrays -import blosc2 import numpy as np +import blosc2 + shape = (10, 10) blocks = (10, 10) dtype = np.float64 diff --git a/examples/ndarray/formats.py b/examples/ndarray/formats.py index 9e70f3f9..9d67c88c 100644 --- a/examples/ndarray/formats.py +++ b/examples/ndarray/formats.py @@ -10,9 +10,10 @@ from time import time -import blosc2 import numpy as np +import blosc2 + urlpath_sparse = "ex_formats_sparse.b2nd" urlpath_contiguous = "ex_formats_contiguous.b2nd" diff --git a/examples/ndarray/general_expressions.py b/examples/ndarray/general_expressions.py index ad4b63bd..c5131976 100644 --- a/examples/ndarray/general_expressions.py +++ b/examples/ndarray/general_expressions.py @@ -8,9 +8,10 @@ # This shows how to build expressions with a general mix of NDArray and NumPy operands. -import blosc2 import numpy as np +import blosc2 + shape = (50, 50) # Create a NDArray from a NumPy array diff --git a/examples/ndarray/getitem.py b/examples/ndarray/getitem.py index 3355c31e..39faf6ac 100644 --- a/examples/ndarray/getitem.py +++ b/examples/ndarray/getitem.py @@ -8,9 +8,10 @@ # Show how getitem / setitem works for an NDArray -import blosc2 import numpy as np +import blosc2 + shape = (10, 10) slices = (slice(2, 7), slice(4, 8)) diff --git a/examples/ndarray/meta.py b/examples/ndarray/meta.py index 71d85a9c..7ae343e8 100644 --- a/examples/ndarray/meta.py +++ b/examples/ndarray/meta.py @@ -8,9 +8,10 @@ # Store metadata in persistent arrays -import blosc2 import numpy as np +import blosc2 + shape = (128, 128) urlpath = "ex_meta.b2nd" dtype = np.complex128 diff --git a/examples/ndarray/ndarray_copy.py b/examples/ndarray/ndarray_copy.py index 1c99e966..b31c4a6d 100644 --- a/examples/ndarray/ndarray_copy.py +++ b/examples/ndarray/ndarray_copy.py @@ -8,9 +8,10 @@ # Copying NDArrays -import blosc2 import numpy as np +import blosc2 + shape = (10, 10) blocks = (10, 10) dtype = np.float64 diff --git a/examples/ndarray/ndmean.py b/examples/ndarray/ndmean.py index 69ec94fe..0f486506 100644 --- a/examples/ndarray/ndmean.py +++ b/examples/ndarray/ndmean.py @@ -7,9 +7,10 @@ ####################################################################### -import blosc2 import numpy as np +import blosc2 + shape = (50, 50) chunks = (49, 49) dtype = np.float64 diff --git a/examples/ndarray/persistency.py b/examples/ndarray/persistency.py index 43d5bf61..22fa8a52 100644 --- a/examples/ndarray/persistency.py +++ b/examples/ndarray/persistency.py @@ -8,9 +8,10 @@ # Shows how you can persist an array on disk -import blosc2 import numpy as np +import blosc2 + shape = (128, 128) urlpath = "ex_persistency.b2nd" dtype = np.complex128 diff --git a/examples/ndarray/reduce_expr.py b/examples/ndarray/reduce_expr.py index f67190df..f5999605 100644 --- a/examples/ndarray/reduce_expr.py +++ b/examples/ndarray/reduce_expr.py @@ -8,9 +8,10 @@ # This shows how to evaluate expressions with NDArray instances as operands. -import blosc2 import numpy as np +import blosc2 + shape = (10, 10, 2) # Create a NDArray from a NumPy array diff --git a/examples/ndarray/reduce_expr_save.py b/examples/ndarray/reduce_expr_save.py index 335ad7b5..3bcc3fa0 100644 --- a/examples/ndarray/reduce_expr_save.py +++ b/examples/ndarray/reduce_expr_save.py @@ -8,9 +8,10 @@ # This shows how to evaluate expressions with NDArray instances as operands. -import blosc2 import numpy as np +import blosc2 + shape = (10, 1, 2) # Create a NDArray from a NumPy array diff --git a/examples/ndarray/reduce_string_expr.py b/examples/ndarray/reduce_string_expr.py index be3b2a48..8e907349 100644 --- a/examples/ndarray/reduce_string_expr.py +++ b/examples/ndarray/reduce_string_expr.py @@ -8,9 +8,10 @@ # This shows how to evaluate expressions with NDArray instances as operands. -import blosc2 import numpy as np +import blosc2 + shape = (10, 10, 2) # Create a NDArray from a NumPy array diff --git a/examples/ndarray/work_with_numpy.py b/examples/ndarray/work_with_numpy.py index 63011ac5..44154ea0 100644 --- a/examples/ndarray/work_with_numpy.py +++ b/examples/ndarray/work_with_numpy.py @@ -8,9 +8,10 @@ # Shows how you can easily convert from/to NumPy arrays -import blosc2 import numpy as np +import blosc2 + shape = (1234, 23) chunks = (253, 23) dtype = bool diff --git a/examples/ndarray/zfp_codec.py b/examples/ndarray/zfp_codec.py index df1f413f..2a7825eb 100644 --- a/examples/ndarray/zfp_codec.py +++ b/examples/ndarray/zfp_codec.py @@ -7,9 +7,10 @@ ####################################################################### -import blosc2 import numpy as np +import blosc2 + shape = (50, 50) chunks = (49, 49) dtype = np.float64 diff --git a/examples/pack_array.py b/examples/pack_array.py index 25a76bd1..b63fd8f8 100644 --- a/examples/pack_array.py +++ b/examples/pack_array.py @@ -8,9 +8,10 @@ # A simple example using the pack and unpack functions -import blosc2 import numpy as np +import blosc2 + a = np.array(["å", "ç", "ø"]) parray = blosc2.pack(a, 9) a2 = blosc2.unpack(parray) diff --git a/examples/pack_tensor.py b/examples/pack_tensor.py index 47ba3135..4e799be9 100644 --- a/examples/pack_tensor.py +++ b/examples/pack_tensor.py @@ -9,9 +9,10 @@ # A simple example using the pack_tensor and unpack_tensor functions -import blosc2 import numpy as np +import blosc2 + a = np.arange(1_000_000) cparams = blosc2.CParams( diff --git a/examples/postfilter1.py b/examples/postfilter1.py index 2343c00e..c6f681f2 100644 --- a/examples/postfilter1.py +++ b/examples/postfilter1.py @@ -6,9 +6,10 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np +import blosc2 + nchunks = 5 input_dtype = np.dtype(np.int32) output_dtype = np.dtype(np.float32) diff --git a/examples/postfilter2.py b/examples/postfilter2.py index cd9190d9..3e5f0979 100644 --- a/examples/postfilter2.py +++ b/examples/postfilter2.py @@ -6,9 +6,10 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np +import blosc2 + nchunks = 10 input_dtype = np.dtype("M8[D]") output_dtype = np.int64 # output dtype has to be of the same size as input diff --git a/examples/postfilter3.py b/examples/postfilter3.py index 87f86d87..5d5f01f0 100644 --- a/examples/postfilter3.py +++ b/examples/postfilter3.py @@ -6,9 +6,10 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np +import blosc2 + nchunks = 10 input_dtype = np.dtype(np.int64) diff --git a/examples/prefilter.py b/examples/prefilter.py index a103c88c..a49cc69d 100644 --- a/examples/prefilter.py +++ b/examples/prefilter.py @@ -8,9 +8,10 @@ # Example of prefiltering data before compression -import blosc2 import numpy as np +import blosc2 + nchunks = 3 input_dtype = np.dtype(np.int32) output_dtype = np.dtype(np.float32) diff --git a/examples/save_tensor.py b/examples/save_tensor.py index 5c123518..e72904ad 100644 --- a/examples/save_tensor.py +++ b/examples/save_tensor.py @@ -9,9 +9,10 @@ # A simple example using the save_tensor and load_tensor functions -import blosc2 import numpy as np +import blosc2 + a = np.arange(1_000_000) file_size = blosc2.save_tensor(a, "save_tensor.bl2", mode="w") diff --git a/examples/schunk.py b/examples/schunk.py index 0f834d9f..07b8c232 100644 --- a/examples/schunk.py +++ b/examples/schunk.py @@ -6,9 +6,10 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np +import blosc2 + nchunks = 10 # Set the compression and decompression parameters cparams = blosc2.CParams(codec=blosc2.Codec.LZ4HC, typesize=4) diff --git a/examples/schunk_roundtrip.py b/examples/schunk_roundtrip.py index 0300700a..e89d1d83 100644 --- a/examples/schunk_roundtrip.py +++ b/examples/schunk_roundtrip.py @@ -6,9 +6,10 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np +import blosc2 + nchunks = 10 # Set the compression and decompression parameters cparams = blosc2.CParams(codec=blosc2.Codec.LZ4HC, typesize=4) diff --git a/examples/ucodecs.py b/examples/ucodecs.py index 13f0f913..663ee2ca 100644 --- a/examples/ucodecs.py +++ b/examples/ucodecs.py @@ -10,9 +10,10 @@ import sys -import blosc2 import numpy as np +import blosc2 + nchunks = 2 chunk_len = 20 * 1000 dtype = np.dtype(np.int32) diff --git a/examples/ufilters.py b/examples/ufilters.py index 2e14fe0d..9285bcb4 100644 --- a/examples/ufilters.py +++ b/examples/ufilters.py @@ -8,9 +8,10 @@ # This shows how to implement an user defined filter in pure Python -import blosc2 import numpy as np +import blosc2 + nchunks = 2 chunk_len = 20 * 1000 dtype = np.dtype(np.int32) diff --git a/examples/vlmeta.py b/examples/vlmeta.py index 577ecc57..4c89e01f 100644 --- a/examples/vlmeta.py +++ b/examples/vlmeta.py @@ -6,9 +6,10 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np +import blosc2 + nchunks = 10 schunk = blosc2.SChunk(chunksize=200 * 1000 * 4) for i in range(nchunks): diff --git a/tests/conftest.py b/tests/conftest.py index da21c61d..5fc5bfdb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,9 +7,10 @@ ####################################################################### import os -import blosc2 import pytest +import blosc2 + # This still needs to pass the '-s' flag to pytest to see the output but anyways @pytest.fixture(scope="session", autouse=True) diff --git a/tests/ndarray/test_auto_parts.py b/tests/ndarray/test_auto_parts.py index 6be86790..94464213 100644 --- a/tests/ndarray/test_auto_parts.py +++ b/tests/ndarray/test_auto_parts.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + ################# Automatic compute of optional chunks and blocks ################# # The exact outcome of these depends on many aspects, including CPUs cache sizes, # so what is done here is mainly a shallow sanity check. Enable the prints in diff --git a/tests/ndarray/test_buffer.py b/tests/ndarray/test_buffer.py index 0cba8aae..ba6daf14 100644 --- a/tests/ndarray/test_buffer.py +++ b/tests/ndarray/test_buffer.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "shape, chunks, blocks, dtype, urlpath, contiguous, meta", diff --git a/tests/ndarray/test_c2array_expr.py b/tests/ndarray/test_c2array_expr.py index a4325d52..91a7bf87 100644 --- a/tests/ndarray/test_c2array_expr.py +++ b/tests/ndarray/test_c2array_expr.py @@ -7,11 +7,12 @@ ####################################################################### import pathlib -import blosc2 import numexpr as ne import numpy as np import pytest +import blosc2 + pytestmark = pytest.mark.network NITEMS_SMALL = 1_000 @@ -210,7 +211,7 @@ def broadcast_shape(request): return request.param -@pytest.fixture() +@pytest.fixture def broadcast_fixture(broadcast_shape, c2sub_context): shape1, shape2 = broadcast_shape dtype = np.float64 diff --git a/tests/ndarray/test_c2array_reductions.py b/tests/ndarray/test_c2array_reductions.py index 0b07b86b..e7e0e759 100644 --- a/tests/ndarray/test_c2array_reductions.py +++ b/tests/ndarray/test_c2array_reductions.py @@ -7,11 +7,12 @@ ####################################################################### import pathlib -import blosc2 import numexpr as ne import numpy as np import pytest +import blosc2 + pytestmark = pytest.mark.network NITEMS_SMALL = 1_000 diff --git a/tests/ndarray/test_c2array_udf.py b/tests/ndarray/test_c2array_udf.py index 85a8084d..77b0f336 100644 --- a/tests/ndarray/test_c2array_udf.py +++ b/tests/ndarray/test_c2array_udf.py @@ -7,10 +7,11 @@ ####################################################################### import pathlib -import blosc2 import numpy as np import pytest +import blosc2 + ROOT = "b2tests" DIR = "expr/" diff --git a/tests/ndarray/test_copy.py b/tests/ndarray/test_copy.py index 5e4529c5..5bf773de 100644 --- a/tests/ndarray/test_copy.py +++ b/tests/ndarray/test_copy.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "shape, chunks1, blocks1, chunks2, blocks2, dtype", diff --git a/tests/ndarray/test_empty.py b/tests/ndarray/test_empty.py index 3d71a181..bf405f70 100644 --- a/tests/ndarray/test_empty.py +++ b/tests/ndarray/test_empty.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "shape, chunks, blocks, dtype, cparams, urlpath, contiguous", diff --git a/tests/ndarray/test_full.py b/tests/ndarray/test_full.py index 52ad5784..9f7f90af 100644 --- a/tests/ndarray/test_full.py +++ b/tests/ndarray/test_full.py @@ -8,10 +8,11 @@ from dataclasses import asdict -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "shape, chunks, blocks, fill_value, dtype, cparams, dparams, urlpath, contiguous", diff --git a/tests/ndarray/test_get_slice_nchunks.py b/tests/ndarray/test_get_slice_nchunks.py index 65e3c039..e7e06c07 100644 --- a/tests/ndarray/test_get_slice_nchunks.py +++ b/tests/ndarray/test_get_slice_nchunks.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + argnames = "shape, chunks, blocks, slices, dtype" argvalues = [ ([456], [258], [73], slice(0, 1), np.int32), diff --git a/tests/ndarray/test_getitem.py b/tests/ndarray/test_getitem.py index 3197cde9..da32a219 100644 --- a/tests/ndarray/test_getitem.py +++ b/tests/ndarray/test_getitem.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + argnames = "shape, chunks, blocks, slices, dtype" argvalues = [ ([456], [258], [73], slice(0, 1), np.int32), diff --git a/tests/ndarray/test_iterchunks_info.py b/tests/ndarray/test_iterchunks_info.py index 7e94dd76..28da1d1a 100644 --- a/tests/ndarray/test_iterchunks_info.py +++ b/tests/ndarray/test_iterchunks_info.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "shape, chunks, dtype, fill_value", diff --git a/tests/ndarray/test_lazyexpr.py b/tests/ndarray/test_lazyexpr.py index 123953f8..47433d8f 100644 --- a/tests/ndarray/test_lazyexpr.py +++ b/tests/ndarray/test_lazyexpr.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numexpr as ne import numpy as np import pytest + +import blosc2 from blosc2.ndarray import get_chunks_idx NITEMS_SMALL = 1_000 @@ -32,7 +33,7 @@ def chunks_blocks_fixture(request): return request.param -@pytest.fixture() +@pytest.fixture def array_fixture(dtype_fixture, shape_fixture, chunks_blocks_fixture): nelems = np.prod(shape_fixture) na1 = np.linspace(0, 10, nelems, dtype=dtype_fixture).reshape(shape_fixture) @@ -711,7 +712,7 @@ def broadcast_shape(request): # Test broadcasting -@pytest.fixture() +@pytest.fixture def broadcast_fixture(dtype_fixture, broadcast_shape): shape1, shape2 = broadcast_shape na1 = np.linspace(0, 1, np.prod(shape1), dtype=dtype_fixture).reshape(shape1) diff --git a/tests/ndarray/test_lazyexpr_fields.py b/tests/ndarray/test_lazyexpr_fields.py index c3dc898e..97f7be6f 100644 --- a/tests/ndarray/test_lazyexpr_fields.py +++ b/tests/ndarray/test_lazyexpr_fields.py @@ -6,11 +6,12 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numexpr as ne import numpy as np import pytest +import blosc2 + NITEMS_SMALL = 1_000 NITEMS = 10_000 @@ -38,7 +39,7 @@ def chunks_blocks_fixture(request): return request.param -@pytest.fixture() +@pytest.fixture def array_fixture(dtype_fixture, shape_fixture, chunks_blocks_fixture): nelems = np.prod(shape_fixture) dt1, dt2 = dtype_fixture diff --git a/tests/ndarray/test_lazyudf.py b/tests/ndarray/test_lazyudf.py index 663723ce..c68f10a4 100644 --- a/tests/ndarray/test_lazyudf.py +++ b/tests/ndarray/test_lazyudf.py @@ -7,10 +7,11 @@ ####################################################################### import math -import blosc2 import numpy as np import pytest +import blosc2 + def udf1p(inputs_tuple, output, offset): x = inputs_tuple[0] diff --git a/tests/ndarray/test_lossy.py b/tests/ndarray/test_lossy.py index 2ec4cba6..09caf737 100644 --- a/tests/ndarray/test_lossy.py +++ b/tests/ndarray/test_lossy.py @@ -8,10 +8,11 @@ from dataclasses import asdict -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "shape, dtype, cparams, urlpath, contiguous", diff --git a/tests/ndarray/test_metalayers.py b/tests/ndarray/test_metalayers.py index 39d2f901..b130edc2 100644 --- a/tests/ndarray/test_metalayers.py +++ b/tests/ndarray/test_metalayers.py @@ -8,10 +8,11 @@ import os -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "contiguous", diff --git a/tests/ndarray/test_mode.py b/tests/ndarray/test_mode.py index a3f917ad..3249fac1 100644 --- a/tests/ndarray/test_mode.py +++ b/tests/ndarray/test_mode.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("mode", ["r", "w", "a"]) @pytest.mark.parametrize("urlpath", ["test_mode.b2nd"]) diff --git a/tests/ndarray/test_nans.py b/tests/ndarray/test_nans.py index 7b713d2f..78d4d5b9 100644 --- a/tests/ndarray/test_nans.py +++ b/tests/ndarray/test_nans.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "shape, dtype", diff --git a/tests/ndarray/test_ndarray.py b/tests/ndarray/test_ndarray.py index 7c39fbec..17d02938 100644 --- a/tests/ndarray/test_ndarray.py +++ b/tests/ndarray/test_ndarray.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("contiguous", [True, False]) @pytest.mark.parametrize("urlpath", [None, "b2frame"]) diff --git a/tests/ndarray/test_numpy.py b/tests/ndarray/test_numpy.py index cc2a247a..f333e86c 100644 --- a/tests/ndarray/test_numpy.py +++ b/tests/ndarray/test_numpy.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "shape, chunks, blocks, dtype", diff --git a/tests/ndarray/test_persistency.py b/tests/ndarray/test_persistency.py index 0a3e3b15..29ee0f07 100644 --- a/tests/ndarray/test_persistency.py +++ b/tests/ndarray/test_persistency.py @@ -7,10 +7,11 @@ ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "contiguous", diff --git a/tests/ndarray/test_proxy.py b/tests/ndarray/test_proxy.py index 1cda10f9..1f3e8c09 100644 --- a/tests/ndarray/test_proxy.py +++ b/tests/ndarray/test_proxy.py @@ -6,9 +6,10 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest + +import blosc2 from blosc2.ndarray import get_chunks_idx argnames = "urlpath, shape, chunks, blocks, slices, dtype" diff --git a/tests/ndarray/test_proxy_c2array.py b/tests/ndarray/test_proxy_c2array.py index 3be06d51..18e5d2e3 100644 --- a/tests/ndarray/test_proxy_c2array.py +++ b/tests/ndarray/test_proxy_c2array.py @@ -7,10 +7,11 @@ ####################################################################### import pathlib -import blosc2 import numpy as np import pytest +import blosc2 + pytestmark = pytest.mark.network NITEMS_SMALL = 1_000 diff --git a/tests/ndarray/test_proxy_expr.py b/tests/ndarray/test_proxy_expr.py index 2479fc90..fa951503 100644 --- a/tests/ndarray/test_proxy_expr.py +++ b/tests/ndarray/test_proxy_expr.py @@ -7,11 +7,12 @@ ####################################################################### import pathlib -import blosc2 import numexpr as ne import numpy as np import pytest +import blosc2 + pytestmark = pytest.mark.network ROOT = "b2tests" diff --git a/tests/ndarray/test_reductions.py b/tests/ndarray/test_reductions.py index 3c7b37a3..82ddc9da 100644 --- a/tests/ndarray/test_reductions.py +++ b/tests/ndarray/test_reductions.py @@ -6,11 +6,12 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numexpr as ne import numpy as np import pytest +import blosc2 + NITEMS_SMALL = 1000 NITEMS = 10_000 @@ -25,7 +26,7 @@ def shape_fixture(request): return request.param -@pytest.fixture() +@pytest.fixture def array_fixture(dtype_fixture, shape_fixture): nelems = np.prod(shape_fixture) na1 = np.linspace(0, 10, nelems, dtype=dtype_fixture).reshape(shape_fixture) diff --git a/tests/ndarray/test_resize.py b/tests/ndarray/test_resize.py index 7d48aa0d..3d778d90 100644 --- a/tests/ndarray/test_resize.py +++ b/tests/ndarray/test_resize.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "shape, new_shape, chunks, blocks, fill_value", diff --git a/tests/ndarray/test_setitem.py b/tests/ndarray/test_setitem.py index 138d9a5c..a9eb1d5c 100644 --- a/tests/ndarray/test_setitem.py +++ b/tests/ndarray/test_setitem.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + argnames = "shape, chunks, blocks, slices, dtype" argvalues = [ ([456], [258], [73], slice(0, 1), np.int32), diff --git a/tests/ndarray/test_slice.py b/tests/ndarray/test_slice.py index 007b6289..efa65bae 100644 --- a/tests/ndarray/test_slice.py +++ b/tests/ndarray/test_slice.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + argnames = "shape, chunks, blocks, slices, dtype" argvalues = [ ([456], [258], [73], slice(0, 1), np.int32), diff --git a/tests/ndarray/test_squeeze.py b/tests/ndarray/test_squeeze.py index 610b6aa9..27c714fd 100644 --- a/tests/ndarray/test_squeeze.py +++ b/tests/ndarray/test_squeeze.py @@ -6,9 +6,10 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import pytest +import blosc2 + @pytest.mark.parametrize( "shape, chunks, blocks, fill_value", diff --git a/tests/ndarray/test_struct_dtype.py b/tests/ndarray/test_struct_dtype.py index e3d09ed9..82017c7b 100644 --- a/tests/ndarray/test_struct_dtype.py +++ b/tests/ndarray/test_struct_dtype.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "shape, dtype, urlpath", diff --git a/tests/ndarray/test_zeros.py b/tests/ndarray/test_zeros.py index bf86324b..73ad366a 100644 --- a/tests/ndarray/test_zeros.py +++ b/tests/ndarray/test_zeros.py @@ -8,10 +8,11 @@ import math -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "shape, chunks, blocks, dtype, cparams, urlpath, contiguous, meta", diff --git a/tests/test_bytes_array.py b/tests/test_bytes_array.py index 390bcc83..8c50b2da 100644 --- a/tests/test_bytes_array.py +++ b/tests/test_bytes_array.py @@ -7,9 +7,10 @@ ####################################################################### -import blosc2 import pytest +import blosc2 + @pytest.mark.parametrize("arr", [b"", b"1" * 7]) @pytest.mark.parametrize("gil", [True, False]) diff --git a/tests/test_comp_info.py b/tests/test_comp_info.py index c231be45..a7df5602 100644 --- a/tests/test_comp_info.py +++ b/tests/test_comp_info.py @@ -7,10 +7,11 @@ ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("codec", blosc2.compressor_list()) def test_comp_info(codec): diff --git a/tests/test_compress2.py b/tests/test_compress2.py index c792f2ff..498921e2 100644 --- a/tests/test_compress2.py +++ b/tests/test_compress2.py @@ -7,10 +7,11 @@ ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + random = np.random.default_rng() diff --git a/tests/test_compression_parameters.py b/tests/test_compression_parameters.py index fcf10470..75f299a3 100644 --- a/tests/test_compression_parameters.py +++ b/tests/test_compression_parameters.py @@ -7,9 +7,10 @@ ####################################################################### -import blosc2 import pytest +import blosc2 + @pytest.mark.parametrize("nthreads, blocksize", [(2, 0), (1, 30), (4, 5)]) def test_compression_parameters(nthreads, blocksize): diff --git a/tests/test_compressors.py b/tests/test_compressors.py index ce34176b..2f63b797 100644 --- a/tests/test_compressors.py +++ b/tests/test_compressors.py @@ -7,9 +7,10 @@ ####################################################################### -import blosc2 import pytest +import blosc2 + @pytest.mark.parametrize("gil", [True, False]) @pytest.mark.parametrize( diff --git a/tests/test_decompress.py b/tests/test_decompress.py index b7b5e450..aa2c9f81 100644 --- a/tests/test_decompress.py +++ b/tests/test_decompress.py @@ -7,10 +7,11 @@ ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + random = np.random.default_rng() diff --git a/tests/test_iterchunks.py b/tests/test_iterchunks.py index 4464ccf4..8c1a8bfb 100644 --- a/tests/test_iterchunks.py +++ b/tests/test_iterchunks.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("contiguous", [True, False]) @pytest.mark.parametrize("urlpath", [None, "b2frame"]) diff --git a/tests/test_mmap.py b/tests/test_mmap.py index e722704b..e368c9b5 100644 --- a/tests/test_mmap.py +++ b/tests/test_mmap.py @@ -1,9 +1,10 @@ import re -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("initial_mapping_size", [None, 1000]) def test_initial_mapping_size(tmp_path, monkeypatch, capfd, initial_mapping_size): diff --git a/tests/test_open.py b/tests/test_open.py index 276173f3..839acbc2 100644 --- a/tests/test_open.py +++ b/tests/test_open.py @@ -9,10 +9,11 @@ import os import random -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("urlpath", ["schunk.b2frame"]) @pytest.mark.parametrize( diff --git a/tests/test_open_c2array.py b/tests/test_open_c2array.py index 742227ef..9d92c2c0 100644 --- a/tests/test_open_c2array.py +++ b/tests/test_open_c2array.py @@ -9,11 +9,12 @@ import pathlib import random -import blosc2 import httpx import numpy as np import pytest +import blosc2 + pytestmark = pytest.mark.network NITEMS_SMALL = 1_000 diff --git a/tests/test_pathlib.py b/tests/test_pathlib.py index 2b147f57..f3c7f785 100644 --- a/tests/test_pathlib.py +++ b/tests/test_pathlib.py @@ -8,10 +8,11 @@ import pathlib -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("mode, mmap_mode", [("r", None), ("w", None), ("a", None), ("r", "r"), ("w", "w+")]) @pytest.mark.parametrize( diff --git a/tests/test_postfilters.py b/tests/test_postfilters.py index 9ad75f1f..cadd646f 100644 --- a/tests/test_postfilters.py +++ b/tests/test_postfilters.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "func, input_dtype, output_dtype, offset", diff --git a/tests/test_prefilters.py b/tests/test_prefilters.py index ab298814..f1fcaa97 100644 --- a/tests/test_prefilters.py +++ b/tests/test_prefilters.py @@ -8,10 +8,11 @@ from dataclasses import asdict, replace -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "func, op_dtype, op2_dtype, schunk_dtype, offset", diff --git a/tests/test_proxy_schunk.py b/tests/test_proxy_schunk.py index f1453d5f..c0fce283 100644 --- a/tests/test_proxy_schunk.py +++ b/tests/test_proxy_schunk.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "contiguous, urlpath, chunksize, nchunks, start, stop", diff --git a/tests/test_python_blosc.py b/tests/test_python_blosc.py index 8914c4ae..6d1001c6 100644 --- a/tests/test_python_blosc.py +++ b/tests/test_python_blosc.py @@ -14,9 +14,10 @@ import os import unittest -import blosc2 import pytest +import blosc2 + try: import numpy as np except ImportError: diff --git a/tests/test_schunk.py b/tests/test_schunk.py index 00d4c8f7..176db54e 100644 --- a/tests/test_schunk.py +++ b/tests/test_schunk.py @@ -9,10 +9,11 @@ import os from dataclasses import asdict, fields, replace -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "urlpath, contiguous, mode, mmap_mode", diff --git a/tests/test_schunk_constructor.py b/tests/test_schunk_constructor.py index aafb3c7b..01dfa259 100644 --- a/tests/test_schunk_constructor.py +++ b/tests/test_schunk_constructor.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("contiguous", [True, False]) @pytest.mark.parametrize("urlpath", [None, "b2frame"]) diff --git a/tests/test_schunk_delete.py b/tests/test_schunk_delete.py index 7836f506..6156c291 100644 --- a/tests/test_schunk_delete.py +++ b/tests/test_schunk_delete.py @@ -8,10 +8,11 @@ import random -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("contiguous", [True, False]) @pytest.mark.parametrize("urlpath", [None, "b2frame"]) diff --git a/tests/test_schunk_get_slice.py b/tests/test_schunk_get_slice.py index 9e5e1d39..d136460a 100644 --- a/tests/test_schunk_get_slice.py +++ b/tests/test_schunk_get_slice.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("contiguous", [True, False]) @pytest.mark.parametrize("urlpath", [None, "b2frame"]) diff --git a/tests/test_schunk_get_slice_nchunks.py b/tests/test_schunk_get_slice_nchunks.py index 638e1416..ecce9cf2 100644 --- a/tests/test_schunk_get_slice_nchunks.py +++ b/tests/test_schunk_get_slice_nchunks.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "contiguous, urlpath, cparams, nchunks, start, stop", diff --git a/tests/test_schunk_insert.py b/tests/test_schunk_insert.py index f58694f3..06fecc95 100644 --- a/tests/test_schunk_insert.py +++ b/tests/test_schunk_insert.py @@ -8,10 +8,11 @@ import random -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("gil", [True, False]) @pytest.mark.parametrize("contiguous", [True, False]) diff --git a/tests/test_schunk_set_slice.py b/tests/test_schunk_set_slice.py index 76ae6097..d78b5e67 100644 --- a/tests/test_schunk_set_slice.py +++ b/tests/test_schunk_set_slice.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("contiguous", [True, False]) @pytest.mark.parametrize("urlpath", [None, "b2frame"]) diff --git a/tests/test_schunk_update.py b/tests/test_schunk_update.py index 5530b207..03a247b0 100644 --- a/tests/test_schunk_update.py +++ b/tests/test_schunk_update.py @@ -8,10 +8,11 @@ import random -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("gil", [True, False]) @pytest.mark.parametrize("contiguous", [True, False]) diff --git a/tests/test_storage.py b/tests/test_storage.py index a31bcc40..4a4b4551 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -8,10 +8,11 @@ from dataclasses import asdict, fields -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "urlpath, contiguous, mode, mmap_mode", diff --git a/tests/test_tensor.py b/tests/test_tensor.py index 6f4da9f9..b351fc97 100644 --- a/tests/test_tensor.py +++ b/tests/test_tensor.py @@ -9,10 +9,11 @@ import os -import blosc2 import numpy as np import pytest +import blosc2 + ##### pack / unpack ##### diff --git a/tests/test_ucodecs.py b/tests/test_ucodecs.py index 0a9cd50f..a20e9abe 100644 --- a/tests/test_ucodecs.py +++ b/tests/test_ucodecs.py @@ -8,10 +8,11 @@ import sys -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "codec_name, id, dtype, cparams", diff --git a/tests/test_ufilters.py b/tests/test_ufilters.py index b2a6e0fe..90b925bb 100644 --- a/tests/test_ufilters.py +++ b/tests/test_ufilters.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize( "filters, filters_meta, dtype", diff --git a/tests/test_vlmeta.py b/tests/test_vlmeta.py index a719e489..9155cc1f 100644 --- a/tests/test_vlmeta.py +++ b/tests/test_vlmeta.py @@ -6,10 +6,11 @@ # LICENSE file in the root directory of this source tree) ####################################################################### -import blosc2 import numpy as np import pytest +import blosc2 + @pytest.mark.parametrize("contiguous", [True, False]) @pytest.mark.parametrize("urlpath", [None, "b2frame"])