numcodecs 0.15.0__cp312-cp312-macosx_10_13_x86_64.whl → 0.15.1__cp312-cp312-macosx_10_13_x86_64.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/checksum32.py +1 -1
- numcodecs/errors.py +26 -0
- numcodecs/json.py +1 -1
- numcodecs/quantize.py +2 -2
- numcodecs/registry.py +2 -1
- numcodecs/tests/test_registry.py +2 -1
- numcodecs/tests/test_zarr3.py +8 -3
- numcodecs/version.py +2 -2
- numcodecs/zarr3.py +5 -5
- {numcodecs-0.15.0.dist-info → numcodecs-0.15.1.dist-info}/METADATA +1 -1
- {numcodecs-0.15.0.dist-info → numcodecs-0.15.1.dist-info}/RECORD +15 -14
- {numcodecs-0.15.0.dist-info → numcodecs-0.15.1.dist-info}/LICENSE.txt +0 -0
- {numcodecs-0.15.0.dist-info → numcodecs-0.15.1.dist-info}/WHEEL +0 -0
- {numcodecs-0.15.0.dist-info → numcodecs-0.15.1.dist-info}/entry_points.txt +0 -0
- {numcodecs-0.15.0.dist-info → numcodecs-0.15.1.dist-info}/top_level.txt +0 -0
numcodecs/checksum32.py
CHANGED
|
@@ -13,7 +13,7 @@ from .jenkins import jenkins_lookup3
|
|
|
13
13
|
|
|
14
14
|
_crc32c: Optional[ModuleType] = None
|
|
15
15
|
with suppress(ImportError):
|
|
16
|
-
import crc32c as _crc32c # type: ignore[no-redef]
|
|
16
|
+
import crc32c as _crc32c # type: ignore[no-redef, unused-ignore]
|
|
17
17
|
|
|
18
18
|
if TYPE_CHECKING: # pragma: no cover
|
|
19
19
|
from typing_extensions import Buffer
|
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}'")
|
numcodecs/json.py
CHANGED
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/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
|
|
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
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
|
|
|
@@ -307,7 +308,7 @@ class FixedScaleOffset(_NumcodecsArrayArrayCodec):
|
|
|
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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: numcodecs
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.1
|
|
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
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
numcodecs-0.15.
|
|
2
|
-
numcodecs-0.15.
|
|
3
|
-
numcodecs-0.15.
|
|
4
|
-
numcodecs-0.15.
|
|
5
|
-
numcodecs-0.15.
|
|
6
|
-
numcodecs-0.15.
|
|
1
|
+
numcodecs-0.15.1.dist-info/RECORD,,
|
|
2
|
+
numcodecs-0.15.1.dist-info/WHEEL,sha256=FBd6an5AFoPq_6i7rX7RY9hnbsVzpIPkc8xRof4mLK4,111
|
|
3
|
+
numcodecs-0.15.1.dist-info/entry_points.txt,sha256=3W3FHKrwE52X3fLq8KdioOtf93lh5KaoGV5t2D10DBI,919
|
|
4
|
+
numcodecs-0.15.1.dist-info/top_level.txt,sha256=JkHllzt6IuVudg4Tk--wF-yfPPsdVOiMTag1tjGIihw,10
|
|
5
|
+
numcodecs-0.15.1.dist-info/LICENSE.txt,sha256=lJysaEeeE7bJeSRjUVC04e9eaXZq2eRy6oWgjBV2u5Y,1124
|
|
6
|
+
numcodecs-0.15.1.dist-info/METADATA,sha256=T3XwC0XFISSWpaQTIYlzENZDZN3F5scItBHMhsR2MLQ,2934
|
|
7
7
|
numcodecs/jenkins.cpython-312-darwin.so,sha256=hdIgsKiX0fK89kuhYfj5wiYxr26IzsjuA3AXdiAJEms,301760
|
|
8
8
|
numcodecs/lzma.py,sha256=6XeJ-c-lTJN1EVrIOb5cEFEiMGlNHsS4c_OentmUox0,2257
|
|
9
9
|
numcodecs/astype.py,sha256=pfdFqjNvb-PETswa2_UxZm632O-y2Lex-g_68IJpiuk,2099
|
|
@@ -11,13 +11,13 @@ numcodecs/gzip.py,sha256=DJuc87g8neqn-SYEeCEQwPSdEN5oZGgDUan9MTI6Fb4,1436
|
|
|
11
11
|
numcodecs/zstd.cpython-312-darwin.so,sha256=CpHw41LkF0gL9hRIPneiETJ0LjXBmgawawZhhPVxHUU,2355872
|
|
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=po5_rvCFTU8xU9IC56wyK0-zfBgz_U4xX6CO2mv9Mzs,413
|
|
15
15
|
numcodecs/compat.py,sha256=JadagE6pTEcrX3V8wDml0n1tdkHvOWo6D21J3a4P0mw,6505
|
|
16
16
|
numcodecs/_shuffle.cpython-312-darwin.so,sha256=GqF_M0HMMoOTn-D_blC9rYALL2IQaOvjxttRyLQIVuQ,282360
|
|
17
|
-
numcodecs/checksum32.py,sha256=
|
|
17
|
+
numcodecs/checksum32.py,sha256=iYJY1oAUQ71_Dk167uBuPh1wLOdozhGCbld7f7-qqhg,5450
|
|
18
18
|
numcodecs/ndarray_like.py,sha256=fVupUg_K_rDZNRlUmTiRp53OmF6YHb-yNyixJNFR8ME,1883
|
|
19
|
-
numcodecs/quantize.py,sha256=
|
|
20
|
-
numcodecs/registry.py,sha256=
|
|
19
|
+
numcodecs/quantize.py,sha256=4mPx4kWanv5wGa22HvEiP893xqG5dDDtN-oKChj6nfE,3016
|
|
20
|
+
numcodecs/registry.py,sha256=oRN9uJsWIosZbAZFkOWyUos3GZ-h_zq_cN-t_uPLk0A,1864
|
|
21
21
|
numcodecs/blosc.cpython-312-darwin.so,sha256=SslXt4zcp_X37CEwZJR-Tz0voUI8Dq12tOlF3MzmyDY,3155656
|
|
22
22
|
numcodecs/pickles.py,sha256=LtcMa6cK-V5TUYJNR4dRDsWWRmLfNv0syZddbrbRv3A,1290
|
|
23
23
|
numcodecs/fixedscaleoffset.py,sha256=fQwP_H-P3Mq4_LXtMQw5CLYeMjCBUdTtV-AKWVAIzkY,4188
|
|
@@ -27,23 +27,24 @@ numcodecs/bitround.py,sha256=4lei39ZG4G2GGkDxl12q29nR5_8a4Icx4T-OgP1A1D4,2845
|
|
|
27
27
|
numcodecs/vlen.cpython-312-darwin.so,sha256=dH9ZW6tRzWioFaibgIK2lZLfe_9AS0sQdEj07KM8mck,408088
|
|
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=dfGgWL1yfB-YPwUzhlDQtfTuNziCeq6m9PvR-X-KlhQ,14665
|
|
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/errors.py,sha256=IV0B9fw_Wn8k3fjLtXOOU_-0_Al-dWY_dizvqFiNwkk,663
|
|
34
35
|
numcodecs/fletcher32.cpython-312-darwin.so,sha256=beeK_lWBzvpayMFT_c_OE_KWyfsC6fbV_W2pVeyzOTA,319976
|
|
35
36
|
numcodecs/compat_ext.cpython-312-darwin.so,sha256=W_FrtK06zzjVZKr6hxKGACKeCb2sH3PuWYFAkI2USvM,80488
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|