numcodecs 0.15.0__cp312-cp312-macosx_11_0_arm64.whl → 0.16.0__cp312-cp312-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of numcodecs might be problematic. Click here for more details.
- numcodecs/__init__.py +1 -1
- numcodecs/_shuffle.cpython-312-darwin.so +0 -0
- numcodecs/blosc.cpython-312-darwin.so +0 -0
- numcodecs/checksum32.py +23 -10
- numcodecs/compat_ext.cpython-312-darwin.so +0 -0
- numcodecs/errors.py +26 -0
- numcodecs/fletcher32.cpython-312-darwin.so +0 -0
- numcodecs/jenkins.cpython-312-darwin.so +0 -0
- numcodecs/json.py +1 -1
- numcodecs/lz4.cpython-312-darwin.so +0 -0
- numcodecs/quantize.py +2 -2
- numcodecs/registry.py +2 -1
- numcodecs/tests/common.py +0 -68
- numcodecs/tests/test_blosc.py +23 -14
- numcodecs/tests/test_registry.py +2 -1
- numcodecs/tests/test_vlen_bytes.py +2 -1
- numcodecs/tests/test_zarr3.py +8 -3
- numcodecs/version.py +9 -4
- numcodecs/vlen.cpython-312-darwin.so +0 -0
- numcodecs/zarr3.py +7 -7
- numcodecs/zstd.cpython-312-darwin.so +0 -0
- {numcodecs-0.15.0.dist-info → numcodecs-0.16.0.dist-info}/METADATA +4 -3
- {numcodecs-0.15.0.dist-info → numcodecs-0.16.0.dist-info}/RECORD +27 -26
- {numcodecs-0.15.0.dist-info → numcodecs-0.16.0.dist-info}/WHEEL +2 -1
- {numcodecs-0.15.0.dist-info → numcodecs-0.16.0.dist-info}/entry_points.txt +0 -0
- {numcodecs-0.15.0.dist-info → numcodecs-0.16.0.dist-info/licenses}/LICENSE.txt +0 -0
- {numcodecs-0.15.0.dist-info → numcodecs-0.16.0.dist-info}/top_level.txt +0 -0
numcodecs/__init__.py
CHANGED
|
Binary file
|
|
Binary file
|
numcodecs/checksum32.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import abc
|
|
1
2
|
import struct
|
|
2
3
|
import zlib
|
|
3
|
-
from collections.abc import Callable
|
|
4
4
|
from contextlib import suppress
|
|
5
5
|
from types import ModuleType
|
|
6
|
-
from typing import
|
|
6
|
+
from typing import Literal, Optional
|
|
7
7
|
|
|
8
8
|
import numpy as np
|
|
9
|
+
from typing_extensions import Buffer
|
|
9
10
|
|
|
10
11
|
from .abc import Codec
|
|
11
12
|
from .compat import ensure_contiguous_ndarray, ndarray_copy
|
|
@@ -13,17 +14,13 @@ from .jenkins import jenkins_lookup3
|
|
|
13
14
|
|
|
14
15
|
_crc32c: Optional[ModuleType] = None
|
|
15
16
|
with suppress(ImportError):
|
|
16
|
-
import crc32c as _crc32c # type: ignore[no-redef]
|
|
17
|
-
|
|
18
|
-
if TYPE_CHECKING: # pragma: no cover
|
|
19
|
-
from typing_extensions import Buffer
|
|
17
|
+
import crc32c as _crc32c # type: ignore[no-redef, unused-ignore]
|
|
20
18
|
|
|
21
19
|
CHECKSUM_LOCATION = Literal['start', 'end']
|
|
22
20
|
|
|
23
21
|
|
|
24
|
-
class Checksum32(Codec):
|
|
22
|
+
class Checksum32(Codec, abc.ABC):
|
|
25
23
|
# override in sub-class
|
|
26
|
-
checksum: Callable[["Buffer", int], int] | None = None
|
|
27
24
|
location: CHECKSUM_LOCATION = 'start'
|
|
28
25
|
|
|
29
26
|
def __init__(self, location: CHECKSUM_LOCATION | None = None):
|
|
@@ -67,6 +64,10 @@ class Checksum32(Codec):
|
|
|
67
64
|
)
|
|
68
65
|
return ndarray_copy(payload_view, out)
|
|
69
66
|
|
|
67
|
+
@staticmethod
|
|
68
|
+
@abc.abstractmethod
|
|
69
|
+
def checksum(data: Buffer, value: int) -> int: ...
|
|
70
|
+
|
|
70
71
|
|
|
71
72
|
class CRC32(Checksum32):
|
|
72
73
|
"""Codec add a crc32 checksum to the buffer.
|
|
@@ -78,9 +79,15 @@ class CRC32(Checksum32):
|
|
|
78
79
|
"""
|
|
79
80
|
|
|
80
81
|
codec_id = 'crc32'
|
|
81
|
-
checksum = zlib.crc32
|
|
82
82
|
location = 'start'
|
|
83
83
|
|
|
84
|
+
@staticmethod
|
|
85
|
+
def checksum(data: Buffer, value: int = 0) -> int:
|
|
86
|
+
"""
|
|
87
|
+
Thin wrapper around ``zlib.crc32``.
|
|
88
|
+
"""
|
|
89
|
+
return zlib.crc32(data, value)
|
|
90
|
+
|
|
84
91
|
|
|
85
92
|
class Adler32(Checksum32):
|
|
86
93
|
"""Codec add a adler32 checksum to the buffer.
|
|
@@ -92,9 +99,15 @@ class Adler32(Checksum32):
|
|
|
92
99
|
"""
|
|
93
100
|
|
|
94
101
|
codec_id = 'adler32'
|
|
95
|
-
checksum = zlib.adler32
|
|
96
102
|
location = 'start'
|
|
97
103
|
|
|
104
|
+
@staticmethod
|
|
105
|
+
def checksum(data: Buffer, value: int = 1) -> int:
|
|
106
|
+
"""
|
|
107
|
+
Thin wrapper around ``zlib.adler32``.
|
|
108
|
+
"""
|
|
109
|
+
return zlib.adler32(data, value)
|
|
110
|
+
|
|
98
111
|
|
|
99
112
|
class JenkinsLookup3(Checksum32):
|
|
100
113
|
"""Bob Jenkin's lookup3 checksum with 32-bit output
|
|
Binary file
|
numcodecs/errors.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines custom exceptions that are raised in the `numcodecs` codebase.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class UnknownCodecError(ValueError):
|
|
7
|
+
"""
|
|
8
|
+
An exception that is raised when trying to receive a codec that has not been registered.
|
|
9
|
+
|
|
10
|
+
Parameters
|
|
11
|
+
----------
|
|
12
|
+
codec_id : str
|
|
13
|
+
Codec identifier.
|
|
14
|
+
|
|
15
|
+
Examples
|
|
16
|
+
----------
|
|
17
|
+
>>> import numcodecs
|
|
18
|
+
>>> numcodecs.get_codec({"codec_id": "unknown"})
|
|
19
|
+
Traceback (most recent call last):
|
|
20
|
+
...
|
|
21
|
+
UnknownCodecError: codec not available: 'unknown'
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self, codec_id: str):
|
|
25
|
+
self.codec_id = codec_id
|
|
26
|
+
super().__init__(f"codec not available: '{codec_id}'")
|
|
Binary file
|
|
Binary file
|
numcodecs/json.py
CHANGED
|
Binary file
|
numcodecs/quantize.py
CHANGED
|
@@ -65,9 +65,9 @@ class Quantize(Codec):
|
|
|
65
65
|
precision = 10.0**-self.digits
|
|
66
66
|
exp = math.log10(precision)
|
|
67
67
|
if exp < 0:
|
|
68
|
-
exp =
|
|
68
|
+
exp = math.floor(exp)
|
|
69
69
|
else:
|
|
70
|
-
exp =
|
|
70
|
+
exp = math.ceil(exp)
|
|
71
71
|
bits = math.ceil(math.log2(10.0**-exp))
|
|
72
72
|
scale = 2.0**bits
|
|
73
73
|
enc = np.around(scale * arr) / scale
|
numcodecs/registry.py
CHANGED
|
@@ -5,6 +5,7 @@ import logging
|
|
|
5
5
|
from importlib.metadata import EntryPoints, entry_points
|
|
6
6
|
|
|
7
7
|
from numcodecs.abc import Codec
|
|
8
|
+
from numcodecs.errors import UnknownCodecError
|
|
8
9
|
|
|
9
10
|
logger = logging.getLogger("numcodecs")
|
|
10
11
|
codec_registry: dict[str, Codec] = {}
|
|
@@ -50,7 +51,7 @@ def get_codec(config):
|
|
|
50
51
|
register_codec(cls, codec_id=codec_id)
|
|
51
52
|
if cls:
|
|
52
53
|
return cls.from_config(config)
|
|
53
|
-
raise
|
|
54
|
+
raise UnknownCodecError(f"{codec_id!r}")
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
def register_codec(cls, codec_id=None):
|
numcodecs/tests/common.py
CHANGED
|
@@ -115,74 +115,6 @@ def check_encode_decode(arr, codec, precision=None):
|
|
|
115
115
|
compare_arrays(arr, out, precision=precision)
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
def check_encode_decode_partial(arr, codec, precision=None):
|
|
119
|
-
# N.B., watch out here with blosc compressor, if the itemsize of
|
|
120
|
-
# the source buffer is different then the results of encoding
|
|
121
|
-
# (i.e., compression) may be different. Hence we *do not* require that
|
|
122
|
-
# the results of encoding be identical for all possible inputs, rather
|
|
123
|
-
# we just require that the results of the encode/decode round-trip can
|
|
124
|
-
# be compared to the original array.
|
|
125
|
-
|
|
126
|
-
itemsize = arr.itemsize
|
|
127
|
-
start, nitems = 5, 10
|
|
128
|
-
compare_arr = arr[start : start + nitems]
|
|
129
|
-
# test encoding of numpy array
|
|
130
|
-
enc = codec.encode(arr)
|
|
131
|
-
dec = codec.decode_partial(enc, start, nitems)
|
|
132
|
-
compare_arrays(compare_arr, dec, precision=precision)
|
|
133
|
-
|
|
134
|
-
# out = np.empty_like(compare_arr)
|
|
135
|
-
out = np.empty_like(compare_arr)
|
|
136
|
-
print(len(out))
|
|
137
|
-
|
|
138
|
-
# test partial decode of encoded bytes
|
|
139
|
-
buf = arr.tobytes(order='A')
|
|
140
|
-
enc = codec.encode(buf)
|
|
141
|
-
dec = codec.decode_partial(enc, start * itemsize, nitems * itemsize, out=out)
|
|
142
|
-
compare_arrays(compare_arr, dec, precision=precision)
|
|
143
|
-
|
|
144
|
-
# test partial decode of encoded bytearray
|
|
145
|
-
buf = bytearray(arr.tobytes(order='A'))
|
|
146
|
-
enc = codec.encode(buf)
|
|
147
|
-
dec = codec.decode_partial(enc, start * itemsize, nitems * itemsize, out=out)
|
|
148
|
-
compare_arrays(compare_arr, dec, precision=precision)
|
|
149
|
-
|
|
150
|
-
# test partial decode of encoded array.array
|
|
151
|
-
buf = array.array('b', arr.tobytes(order='A'))
|
|
152
|
-
enc = codec.encode(buf)
|
|
153
|
-
dec = codec.decode_partial(enc, start * itemsize, nitems * itemsize, out=out)
|
|
154
|
-
compare_arrays(compare_arr, dec, precision=precision)
|
|
155
|
-
|
|
156
|
-
# # decoding should support any object exporting the buffer protocol,
|
|
157
|
-
|
|
158
|
-
# # setup
|
|
159
|
-
enc_bytes = ensure_bytes(enc)
|
|
160
|
-
|
|
161
|
-
# test decoding of raw bytes into numpy array
|
|
162
|
-
dec = codec.decode_partial(enc_bytes, start * itemsize, nitems * itemsize, out=out)
|
|
163
|
-
compare_arrays(compare_arr, dec, precision=precision)
|
|
164
|
-
|
|
165
|
-
# test partial decoding of bytearray
|
|
166
|
-
dec = codec.decode_partial(bytearray(enc_bytes), start * itemsize, nitems * itemsize, out=out)
|
|
167
|
-
compare_arrays(compare_arr, dec, precision=precision)
|
|
168
|
-
|
|
169
|
-
# test partial decoding of array.array
|
|
170
|
-
buf = array.array('b', enc_bytes)
|
|
171
|
-
dec = codec.decode_partial(buf, start * itemsize, nitems * itemsize, out=out)
|
|
172
|
-
compare_arrays(compare_arr, dec, precision=precision)
|
|
173
|
-
|
|
174
|
-
# test decoding of numpy array into numpy array
|
|
175
|
-
buf = np.frombuffer(enc_bytes, dtype='u1')
|
|
176
|
-
dec = codec.decode_partial(buf, start * itemsize, nitems * itemsize, out=out)
|
|
177
|
-
compare_arrays(compare_arr, dec, precision=precision)
|
|
178
|
-
|
|
179
|
-
# test decoding directly into bytearray
|
|
180
|
-
out = bytearray(compare_arr.nbytes)
|
|
181
|
-
codec.decode_partial(enc_bytes, start * itemsize, nitems * itemsize, out=out)
|
|
182
|
-
# noinspection PyTypeChecker
|
|
183
|
-
compare_arrays(compare_arr, out, precision=precision)
|
|
184
|
-
|
|
185
|
-
|
|
186
118
|
def assert_array_items_equal(res, arr):
|
|
187
119
|
assert isinstance(res, np.ndarray)
|
|
188
120
|
res = res.reshape(-1, order='A')
|
numcodecs/tests/test_blosc.py
CHANGED
|
@@ -15,7 +15,6 @@ from numcodecs.tests.common import (
|
|
|
15
15
|
check_backwards_compatibility,
|
|
16
16
|
check_config,
|
|
17
17
|
check_encode_decode,
|
|
18
|
-
check_encode_decode_partial,
|
|
19
18
|
check_err_decode_object_buffer,
|
|
20
19
|
check_err_encode_object_buffer,
|
|
21
20
|
check_max_buffer_size,
|
|
@@ -75,19 +74,6 @@ def test_encode_decode(array, codec):
|
|
|
75
74
|
check_encode_decode(array, codec)
|
|
76
75
|
|
|
77
76
|
|
|
78
|
-
@pytest.mark.parametrize('codec', codecs)
|
|
79
|
-
@pytest.mark.parametrize(
|
|
80
|
-
'array',
|
|
81
|
-
[
|
|
82
|
-
pytest.param(x) if len(x.shape) == 1 else pytest.param(x, marks=[pytest.mark.xfail])
|
|
83
|
-
for x in arrays
|
|
84
|
-
],
|
|
85
|
-
)
|
|
86
|
-
def test_partial_decode(codec, array):
|
|
87
|
-
_skip_null(codec)
|
|
88
|
-
check_encode_decode_partial(array, codec)
|
|
89
|
-
|
|
90
|
-
|
|
91
77
|
def test_config():
|
|
92
78
|
codec = Blosc(cname='zstd', clevel=3, shuffle=1)
|
|
93
79
|
check_config(codec)
|
|
@@ -273,3 +259,26 @@ def test_max_buffer_size():
|
|
|
273
259
|
_skip_null(codec)
|
|
274
260
|
assert codec.max_buffer_size == 2**31 - 1
|
|
275
261
|
check_max_buffer_size(codec)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def test_typesize_explicit():
|
|
265
|
+
arr = np.arange(100).astype("int64")
|
|
266
|
+
itemsize = arr.itemsize
|
|
267
|
+
codec_no_type_size = Blosc(shuffle=Blosc.SHUFFLE)
|
|
268
|
+
codec_itemsize = Blosc(shuffle=Blosc.SHUFFLE, typesize=itemsize)
|
|
269
|
+
encoded_without_itemsize = codec_no_type_size.encode(arr.tobytes())
|
|
270
|
+
encoded_with_itemsize = codec_itemsize.encode(arr.tobytes())
|
|
271
|
+
# third byte encodes the `typesize`
|
|
272
|
+
assert encoded_without_itemsize[3] == 1 # inferred from bytes i.e., 1
|
|
273
|
+
assert encoded_with_itemsize[3] == itemsize # given as a constructor argument
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def test_typesize_less_than_1():
|
|
277
|
+
with pytest.raises(ValueError, match=r"Cannot use typesize"):
|
|
278
|
+
Blosc(shuffle=Blosc.SHUFFLE, typesize=0)
|
|
279
|
+
compressor = Blosc(shuffle=Blosc.SHUFFLE)
|
|
280
|
+
# not really something that should be done in practice, but good for testing.
|
|
281
|
+
compressor.typesize = 0
|
|
282
|
+
arr = np.arange(100)
|
|
283
|
+
with pytest.raises(ValueError, match=r"Cannot use typesize"):
|
|
284
|
+
compressor.encode(arr.tobytes())
|
numcodecs/tests/test_registry.py
CHANGED
|
@@ -3,11 +3,12 @@ import inspect
|
|
|
3
3
|
import pytest
|
|
4
4
|
|
|
5
5
|
import numcodecs
|
|
6
|
+
from numcodecs.errors import UnknownCodecError
|
|
6
7
|
from numcodecs.registry import get_codec
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def test_registry_errors():
|
|
10
|
-
with pytest.raises(
|
|
11
|
+
with pytest.raises(UnknownCodecError, match='foo'):
|
|
11
12
|
get_codec({'id': 'foo'})
|
|
12
13
|
|
|
13
14
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import sys
|
|
1
2
|
import unittest
|
|
2
3
|
|
|
3
4
|
import numpy as np
|
|
@@ -86,7 +87,7 @@ def test_decode_errors():
|
|
|
86
87
|
|
|
87
88
|
# TODO: fix this test on GitHub actions somehow...
|
|
88
89
|
# See https://github.com/zarr-developers/numcodecs/issues/683
|
|
89
|
-
@pytest.mark.
|
|
90
|
+
@pytest.mark.skipif(sys.platform == "darwin", reason="Test is failing on macOS on GitHub actions.")
|
|
90
91
|
def test_encode_none():
|
|
91
92
|
a = np.array([b'foo', None, b'bar'], dtype=object)
|
|
92
93
|
codec = VLenBytes()
|
numcodecs/tests/test_zarr3.py
CHANGED
|
@@ -91,7 +91,7 @@ def test_generic_compressor(
|
|
|
91
91
|
(numcodecs.zarr3.Delta, {"dtype": "float32"}),
|
|
92
92
|
(numcodecs.zarr3.FixedScaleOffset, {"offset": 0, "scale": 25.5}),
|
|
93
93
|
(numcodecs.zarr3.FixedScaleOffset, {"offset": 0, "scale": 51, "astype": "uint16"}),
|
|
94
|
-
(numcodecs.zarr3.AsType, {"encode_dtype": "float32", "decode_dtype": "
|
|
94
|
+
(numcodecs.zarr3.AsType, {"encode_dtype": "float32", "decode_dtype": "float32"}),
|
|
95
95
|
],
|
|
96
96
|
ids=[
|
|
97
97
|
"delta",
|
|
@@ -225,11 +225,11 @@ def test_generic_bytes_codec(
|
|
|
225
225
|
):
|
|
226
226
|
try:
|
|
227
227
|
codec_class()._codec # noqa: B018
|
|
228
|
-
except ValueError as e:
|
|
228
|
+
except ValueError as e: # pragma: no cover
|
|
229
229
|
if "codec not available" in str(e):
|
|
230
230
|
pytest.xfail(f"{codec_class.codec_name} is not available: {e}")
|
|
231
231
|
else:
|
|
232
|
-
raise
|
|
232
|
+
raise
|
|
233
233
|
except ImportError as e: # pragma: no cover
|
|
234
234
|
pytest.xfail(f"{codec_class.codec_name} is not available: {e}")
|
|
235
235
|
|
|
@@ -272,3 +272,8 @@ def test_delta_astype(store: StorePath):
|
|
|
272
272
|
def test_repr():
|
|
273
273
|
codec = numcodecs.zarr3.LZ4(level=5)
|
|
274
274
|
assert repr(codec) == "LZ4(codec_name='numcodecs.lz4', codec_config={'level': 5})"
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def test_to_dict():
|
|
278
|
+
codec = numcodecs.zarr3.LZ4(level=5)
|
|
279
|
+
assert codec.to_dict() == {"name": "numcodecs.lz4", "configuration": {"level": 5}}
|
numcodecs/version.py
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
# file generated by
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
2
|
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
|
5
|
+
|
|
3
6
|
TYPE_CHECKING = False
|
|
4
7
|
if TYPE_CHECKING:
|
|
5
|
-
from typing import Tuple
|
|
8
|
+
from typing import Tuple
|
|
9
|
+
from typing import Union
|
|
10
|
+
|
|
6
11
|
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
12
|
else:
|
|
8
13
|
VERSION_TUPLE = object
|
|
@@ -12,5 +17,5 @@ __version__: str
|
|
|
12
17
|
__version_tuple__: VERSION_TUPLE
|
|
13
18
|
version_tuple: VERSION_TUPLE
|
|
14
19
|
|
|
15
|
-
__version__ = version = '0.
|
|
16
|
-
__version_tuple__ = version_tuple = (0,
|
|
20
|
+
__version__ = version = '0.16.0'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 16, 0)
|
|
Binary file
|
numcodecs/zarr3.py
CHANGED
|
@@ -112,6 +112,7 @@ class _NumcodecsCodec(Metadata):
|
|
|
112
112
|
|
|
113
113
|
def to_dict(self) -> dict[str, JSON]:
|
|
114
114
|
codec_config = self.codec_config.copy()
|
|
115
|
+
codec_config.pop("id", None)
|
|
115
116
|
return {
|
|
116
117
|
"name": self.codec_name,
|
|
117
118
|
"configuration": codec_config,
|
|
@@ -270,7 +271,7 @@ class Shuffle(_NumcodecsBytesBytesCodec):
|
|
|
270
271
|
super().__init__(**codec_config)
|
|
271
272
|
|
|
272
273
|
def evolve_from_array_spec(self, array_spec: ArraySpec) -> Shuffle:
|
|
273
|
-
if
|
|
274
|
+
if self.codec_config.get("elementsize", None) is None:
|
|
274
275
|
return Shuffle(**{**self.codec_config, "elementsize": array_spec.dtype.itemsize})
|
|
275
276
|
return self # pragma: no cover
|
|
276
277
|
|
|
@@ -285,7 +286,7 @@ class Delta(_NumcodecsArrayArrayCodec):
|
|
|
285
286
|
|
|
286
287
|
def resolve_metadata(self, chunk_spec: ArraySpec) -> ArraySpec:
|
|
287
288
|
if astype := self.codec_config.get("astype"):
|
|
288
|
-
return replace(chunk_spec, dtype=np.dtype(astype)) # type: ignore[
|
|
289
|
+
return replace(chunk_spec, dtype=np.dtype(astype)) # type: ignore[call-overload]
|
|
289
290
|
return chunk_spec
|
|
290
291
|
|
|
291
292
|
|
|
@@ -303,11 +304,11 @@ class FixedScaleOffset(_NumcodecsArrayArrayCodec):
|
|
|
303
304
|
|
|
304
305
|
def resolve_metadata(self, chunk_spec: ArraySpec) -> ArraySpec:
|
|
305
306
|
if astype := self.codec_config.get("astype"):
|
|
306
|
-
return replace(chunk_spec, dtype=np.dtype(astype)) # type: ignore[
|
|
307
|
+
return replace(chunk_spec, dtype=np.dtype(astype)) # type: ignore[call-overload]
|
|
307
308
|
return chunk_spec
|
|
308
309
|
|
|
309
310
|
def evolve_from_array_spec(self, array_spec: ArraySpec) -> FixedScaleOffset:
|
|
310
|
-
if
|
|
311
|
+
if self.codec_config.get("dtype", None) is None:
|
|
311
312
|
return FixedScaleOffset(**{**self.codec_config, "dtype": str(array_spec.dtype)})
|
|
312
313
|
return self
|
|
313
314
|
|
|
@@ -320,7 +321,7 @@ class Quantize(_NumcodecsArrayArrayCodec):
|
|
|
320
321
|
super().__init__(**codec_config)
|
|
321
322
|
|
|
322
323
|
def evolve_from_array_spec(self, array_spec: ArraySpec) -> Quantize:
|
|
323
|
-
if
|
|
324
|
+
if self.codec_config.get("dtype", None) is None:
|
|
324
325
|
return Quantize(**{**self.codec_config, "dtype": str(array_spec.dtype)})
|
|
325
326
|
return self
|
|
326
327
|
|
|
@@ -355,8 +356,7 @@ class AsType(_NumcodecsArrayArrayCodec):
|
|
|
355
356
|
return replace(chunk_spec, dtype=np.dtype(self.codec_config["encode_dtype"])) # type: ignore[arg-type]
|
|
356
357
|
|
|
357
358
|
def evolve_from_array_spec(self, array_spec: ArraySpec) -> AsType:
|
|
358
|
-
|
|
359
|
-
if str(array_spec.dtype) != decode_dtype:
|
|
359
|
+
if self.codec_config.get("decode_dtype", None) is None:
|
|
360
360
|
return AsType(**{**self.codec_config, "decode_dtype": str(array_spec.dtype)})
|
|
361
361
|
return self
|
|
362
362
|
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: numcodecs
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.16.0
|
|
4
4
|
Summary: A Python package providing buffer compression and transformation codecs for use in data storage and communication applications.
|
|
5
5
|
Maintainer-email: Alistair Miles <alimanfoo@googlemail.com>
|
|
6
6
|
License: MIT
|
|
@@ -22,7 +22,7 @@ Requires-Python: >=3.11
|
|
|
22
22
|
Description-Content-Type: text/x-rst
|
|
23
23
|
License-File: LICENSE.txt
|
|
24
24
|
Requires-Dist: numpy>=1.24
|
|
25
|
-
Requires-Dist:
|
|
25
|
+
Requires-Dist: typing_extensions
|
|
26
26
|
Provides-Extra: docs
|
|
27
27
|
Requires-Dist: sphinx; extra == "docs"
|
|
28
28
|
Requires-Dist: sphinx-issues; extra == "docs"
|
|
@@ -42,6 +42,7 @@ Provides-Extra: pcodec
|
|
|
42
42
|
Requires-Dist: pcodec<0.4,>=0.3; extra == "pcodec"
|
|
43
43
|
Provides-Extra: crc32c
|
|
44
44
|
Requires-Dist: crc32c>=2.7; extra == "crc32c"
|
|
45
|
+
Dynamic: license-file
|
|
45
46
|
|
|
46
47
|
Numcodecs
|
|
47
48
|
=========
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
numcodecs-0.
|
|
2
|
-
numcodecs-0.
|
|
3
|
-
numcodecs-0.
|
|
4
|
-
numcodecs-0.
|
|
5
|
-
numcodecs-0.
|
|
6
|
-
numcodecs-0.
|
|
7
|
-
numcodecs/jenkins.cpython-312-darwin.so,sha256=
|
|
1
|
+
numcodecs-0.16.0.dist-info/RECORD,,
|
|
2
|
+
numcodecs-0.16.0.dist-info/WHEEL,sha256=KHOVnc2vWrx65VXrDDCaawSLNQgekLqYoXzctjltp_U,136
|
|
3
|
+
numcodecs-0.16.0.dist-info/entry_points.txt,sha256=3W3FHKrwE52X3fLq8KdioOtf93lh5KaoGV5t2D10DBI,919
|
|
4
|
+
numcodecs-0.16.0.dist-info/top_level.txt,sha256=JkHllzt6IuVudg4Tk--wF-yfPPsdVOiMTag1tjGIihw,10
|
|
5
|
+
numcodecs-0.16.0.dist-info/METADATA,sha256=-ZkkQ6ebbtSkYNiXx2UGU4fpAbdUH6ocVxEbbdxx0DI,2963
|
|
6
|
+
numcodecs-0.16.0.dist-info/licenses/LICENSE.txt,sha256=lJysaEeeE7bJeSRjUVC04e9eaXZq2eRy6oWgjBV2u5Y,1124
|
|
7
|
+
numcodecs/jenkins.cpython-312-darwin.so,sha256=KoRbaeKu_HN4edsGmpHiJ_mHwodBcz7a42bU_2wzVKQ,203712
|
|
8
8
|
numcodecs/lzma.py,sha256=6XeJ-c-lTJN1EVrIOb5cEFEiMGlNHsS4c_OentmUox0,2257
|
|
9
9
|
numcodecs/astype.py,sha256=pfdFqjNvb-PETswa2_UxZm632O-y2Lex-g_68IJpiuk,2099
|
|
10
10
|
numcodecs/gzip.py,sha256=DJuc87g8neqn-SYEeCEQwPSdEN5oZGgDUan9MTI6Fb4,1436
|
|
11
|
-
numcodecs/zstd.cpython-312-darwin.so,sha256=
|
|
11
|
+
numcodecs/zstd.cpython-312-darwin.so,sha256=o_b5nzmT89tSVN7WDXbooXInhLvmiU6UnaDxESTvFDg,731752
|
|
12
12
|
numcodecs/base64.py,sha256=79BSqVvloKc8JYenUQfqdPm0a0JAZhd9Zld7k5Cp2lc,752
|
|
13
13
|
numcodecs/bz2.py,sha256=4Ups3IMVsjvBlXyaeYONPdE14TaK9V-4LH5LSNe7AGc,1174
|
|
14
|
-
numcodecs/version.py,sha256=
|
|
14
|
+
numcodecs/version.py,sha256=DiQpBIZMVT47CbF7vAc_z27p1BtVHJkNlV2_J-6KcLU,513
|
|
15
15
|
numcodecs/compat.py,sha256=JadagE6pTEcrX3V8wDml0n1tdkHvOWo6D21J3a4P0mw,6505
|
|
16
|
-
numcodecs/_shuffle.cpython-312-darwin.so,sha256=
|
|
17
|
-
numcodecs/checksum32.py,sha256=
|
|
16
|
+
numcodecs/_shuffle.cpython-312-darwin.so,sha256=bCt6FUlpbM0ilczFf1AGGXZ7eNtjasu__G1cLXPs848,182736
|
|
17
|
+
numcodecs/checksum32.py,sha256=KoaT9cwXE-JEdwjEi6v5CM8HDgRcdqPm-G6IwEp45Po,5726
|
|
18
18
|
numcodecs/ndarray_like.py,sha256=fVupUg_K_rDZNRlUmTiRp53OmF6YHb-yNyixJNFR8ME,1883
|
|
19
|
-
numcodecs/quantize.py,sha256=
|
|
20
|
-
numcodecs/registry.py,sha256=
|
|
21
|
-
numcodecs/blosc.cpython-312-darwin.so,sha256=
|
|
19
|
+
numcodecs/quantize.py,sha256=4mPx4kWanv5wGa22HvEiP893xqG5dDDtN-oKChj6nfE,3016
|
|
20
|
+
numcodecs/registry.py,sha256=oRN9uJsWIosZbAZFkOWyUos3GZ-h_zq_cN-t_uPLk0A,1864
|
|
21
|
+
numcodecs/blosc.cpython-312-darwin.so,sha256=s4LV5INzmMFL2Vh2KdMGjBPkk35Dq_Hg6afweqXXkQ4,1041880
|
|
22
22
|
numcodecs/pickles.py,sha256=LtcMa6cK-V5TUYJNR4dRDsWWRmLfNv0syZddbrbRv3A,1290
|
|
23
23
|
numcodecs/fixedscaleoffset.py,sha256=fQwP_H-P3Mq4_LXtMQw5CLYeMjCBUdTtV-AKWVAIzkY,4188
|
|
24
|
-
numcodecs/lz4.cpython-312-darwin.so,sha256=
|
|
25
|
-
numcodecs/__init__.py,sha256=
|
|
24
|
+
numcodecs/lz4.cpython-312-darwin.so,sha256=fhQui0mYONVOVugGm8Qgkhhm7zNmePjYMIIPm401T8E,248824
|
|
25
|
+
numcodecs/__init__.py,sha256=cgA3s5JGgVs9lAu6olFajOWgHpsCYtnLih10kMBBxS0,3104
|
|
26
26
|
numcodecs/bitround.py,sha256=4lei39ZG4G2GGkDxl12q29nR5_8a4Icx4T-OgP1A1D4,2845
|
|
27
|
-
numcodecs/vlen.cpython-312-darwin.so,sha256=
|
|
27
|
+
numcodecs/vlen.cpython-312-darwin.so,sha256=rAiRSHLKwyqxdZDWQ6AE7BzWpUr1KJxz4W4ojgT5qgU,262120
|
|
28
28
|
numcodecs/zlib.py,sha256=gLPUICEQc5p6DICC_63nOsbUqxzJH_5ynuzenTQXzOQ,1049
|
|
29
29
|
numcodecs/shuffle.py,sha256=hYOFJOCEeDSNI-TqT1JrbQxbprkQD4R8VfSzD4IPI3I,1575
|
|
30
|
-
numcodecs/zarr3.py,sha256=
|
|
30
|
+
numcodecs/zarr3.py,sha256=SG3H69Xj3jUwo2ArGOrPW3zZ0B_Hw4zcQf6Ve_GrpsE,14675
|
|
31
31
|
numcodecs/delta.py,sha256=x0PjNiuX48rmh9M6ZHoYkI9bKOq00Aiyz_jLrVlAq8w,2791
|
|
32
32
|
numcodecs/zfpy.py,sha256=--TCrXOsSJ-2uU_7d-0YwHpk8Hti98hofB4jht5helk,3900
|
|
33
33
|
numcodecs/msgpacks.py,sha256=GkTcFJrhKdpWnwQn4-282q4_edqlzZFdJFux2LtNk30,2619
|
|
34
|
-
numcodecs/
|
|
35
|
-
numcodecs/
|
|
34
|
+
numcodecs/errors.py,sha256=IV0B9fw_Wn8k3fjLtXOOU_-0_Al-dWY_dizvqFiNwkk,663
|
|
35
|
+
numcodecs/fletcher32.cpython-312-darwin.so,sha256=_6uc-5guAiy1tdP1UWnluGsXlL6qb12JA7WpRa0ommc,206800
|
|
36
|
+
numcodecs/compat_ext.cpython-312-darwin.so,sha256=20-oYoRFJ2w3IZpzh8GqOGlAVQ5Rd-_237zqsXnzZ0E,57408
|
|
36
37
|
numcodecs/packbits.py,sha256=L7gM-8AQQTPC2IOPbatzNp-tH67EUp0Tonx_JSYHje4,1993
|
|
37
38
|
numcodecs/categorize.py,sha256=jPipT6mVrpGSe9QuI-MeVzTZuUKAZWF0XN5Wj_8Ifng,2948
|
|
38
|
-
numcodecs/json.py,sha256=
|
|
39
|
+
numcodecs/json.py,sha256=WQcDcDPVxAQm-sxUg_XD70InKLD4iyjQOBiHPn2N3VE,3393
|
|
39
40
|
numcodecs/abc.py,sha256=13vRquZ-u_n1YqM9SYx8sBDseJlH9A_A57_Z2QE-4KY,4504
|
|
40
41
|
numcodecs/pcodec.py,sha256=ZB2Hw5l7aOKi0hOQ3M7GOAwaTNCBRiNr_8IpJPdrcE4,4714
|
|
41
42
|
numcodecs/tests/test_categorize.py,sha256=ftL-LSVq63R-kGuQxUb96uL1e563mlF9CWAf3yQB-Bk,2756
|
|
42
|
-
numcodecs/tests/test_registry.py,sha256=
|
|
43
|
+
numcodecs/tests/test_registry.py,sha256=9Wp-VxGtEtNvwj46Edv6R8Jc4WPu80yWP7mRZyxepJ4,1116
|
|
43
44
|
numcodecs/tests/test_vlen_utf8.py,sha256=H92YtqNY0kpO2Icu1Ey2iItK38ZhKMnJi_2FBwcKSvU,2474
|
|
44
45
|
numcodecs/tests/test_bitround.py,sha256=ayCuANNDA0cP3mqZkJ90QU9eI7ws4-lPRKU_gkflOlg,2349
|
|
45
46
|
numcodecs/tests/test_gzip.py,sha256=I685q0_vu3b_JibUz3nhW1mQtlLSQzGdgGD2twbGPXc,2925
|
|
46
|
-
numcodecs/tests/test_zarr3.py,sha256=
|
|
47
|
+
numcodecs/tests/test_zarr3.py,sha256=LbOuTVEn1XGhtLNx3Sv3wUu3gl0kV7ne_gE_cloUYIE,8483
|
|
47
48
|
numcodecs/tests/test_delta.py,sha256=1_XnV1JYMEnxO0iXDXVSzTltjRPtdoEb4Y8TpmllS-o,1636
|
|
48
49
|
numcodecs/tests/test_lzma.py,sha256=mPj5MebkWg1h0W4ClFF_34cJ0_Toje7z7JZ8gOMngzs,2723
|
|
49
50
|
numcodecs/tests/test_bz2.py,sha256=pefO_YlOLr-RIswHas8DAQ4j81jhqLT5XGEuQ2i8DtI,1889
|
|
@@ -58,7 +59,7 @@ numcodecs/tests/test_astype.py,sha256=Wu1HtHZA6K_rW-JCxSWmU4Wwp9U83JUbUZ2ro9xDk9
|
|
|
58
59
|
numcodecs/tests/test_jenkins.py,sha256=DoOXdTLD25aXA0nwiO1zk_vG4N2UI6Wc3C72yqIByNc,4446
|
|
59
60
|
numcodecs/tests/test_fletcher32.py,sha256=hNf2zSAi16k4222qI2k-n5X4GgswVBfOqvKHSgSoRxQ,1456
|
|
60
61
|
numcodecs/tests/test_packbits.py,sha256=8B2sQnM-DiAEtehCEm5xm7fQ1xWm0rMk_z7Uk8OXvGI,989
|
|
61
|
-
numcodecs/tests/common.py,sha256=
|
|
62
|
+
numcodecs/tests/common.py,sha256=5U3kGYIpVLSBbjqRONDDZxzg2eIlTS5EVmn5Lzp9E4I,9336
|
|
62
63
|
numcodecs/tests/test_base64.py,sha256=QseE5-aDwz7yv5-0dAG_6vTjeN3OpFvgcg8IhklRA4Y,2315
|
|
63
64
|
numcodecs/tests/test_shuffle.py,sha256=uFWTuBbdcqwnWbyh2knwc46klZ00VekzWh8Ya0I2HiE,4659
|
|
64
65
|
numcodecs/tests/test_fixedscaleoffset.py,sha256=3RclYFw3WFu36WUIciZ23gNIiBmzboXvrEugMw1311A,2536
|
|
@@ -68,11 +69,11 @@ numcodecs/tests/test_json.py,sha256=od5MZbSclKFWM_RjS2DsVWGIYlJXG6-wm0yQLdkBTh0,
|
|
|
68
69
|
numcodecs/tests/test_ndarray_like.py,sha256=Bh8wDqkbSL-yr_MDQqE5XUoWzZav5J_VzC8Lfv3BBlA,1273
|
|
69
70
|
numcodecs/tests/test_vlen_array.py,sha256=QaWVuflGxQUFToVcWVIzZHG_b8Vm4JJG6mBZVGNasK0,2477
|
|
70
71
|
numcodecs/tests/test_zstd.py,sha256=79R6VMhni-6kg9LmlmBzGe22HXhg0RvSVjw4jVNPMJQ,2610
|
|
71
|
-
numcodecs/tests/test_vlen_bytes.py,sha256=
|
|
72
|
+
numcodecs/tests/test_vlen_bytes.py,sha256=jmjWdWHhB2pbVKMCVlqwP0Ztnnc1UVZbA3rInucP6KE,2697
|
|
72
73
|
numcodecs/tests/test_entrypoints.py,sha256=zWbyosPRhbSevwp4grlfjfnEyIneny-u7XmMe1xcoLI,504
|
|
73
74
|
numcodecs/tests/test_zarr3_import.py,sha256=JBDyrL57lbZMI9axb9eA1OZnd_Lg-ppfsNV3VvxwVxk,332
|
|
74
75
|
numcodecs/tests/test_checksum32.py,sha256=D0BV_p3XQ2Dv9jIoI9zEQel-PO25KWYIpUDgrhr6Cf8,4601
|
|
75
76
|
numcodecs/tests/test_zfpy.py,sha256=g_2txraHDbnBPtbymJXsgAiD6MBH44-JYRkNx9tttYw,2762
|
|
76
|
-
numcodecs/tests/test_blosc.py,sha256=
|
|
77
|
+
numcodecs/tests/test_blosc.py,sha256=Ym1JtkbUhsXY_zEkyNU6lt4hbR_zZnM0WzbT33dZs7k,9496
|
|
77
78
|
numcodecs/tests/package_with_entrypoint-0.1.dist-info/entry_points.txt,sha256=wel2k9KStuNez__clm2tjAwrcXiP17De8yNScHYtQZU,60
|
|
78
79
|
numcodecs/tests/package_with_entrypoint/__init__.py,sha256=wLyrk73nqKO8rcFtA_sXlcC8PKMzdYbbBRY8eH8Xc10,212
|
|
File without changes
|
|
File without changes
|
|
File without changes
|