numcodecs 0.13.0__cp311-cp311-win_amd64.whl → 0.13.1__cp311-cp311-win_amd64.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 +4 -6
- numcodecs/_shuffle.cp311-win_amd64.pyd +0 -0
- numcodecs/abc.py +2 -4
- numcodecs/astype.py +2 -4
- numcodecs/bitround.py +0 -1
- numcodecs/blosc.cp311-win_amd64.pyd +0 -0
- numcodecs/bz2.py +1 -2
- numcodecs/categorize.py +5 -12
- numcodecs/checksum32.py +1 -3
- numcodecs/compat.py +4 -6
- numcodecs/compat_ext.cp311-win_amd64.pyd +0 -0
- numcodecs/delta.py +2 -3
- numcodecs/fixedscaleoffset.py +3 -9
- numcodecs/fletcher32.cp311-win_amd64.pyd +0 -0
- numcodecs/jenkins.cp311-win_amd64.pyd +0 -0
- numcodecs/json.py +7 -8
- numcodecs/lz4.cp311-win_amd64.pyd +0 -0
- numcodecs/lzma.py +2 -9
- numcodecs/msgpacks.py +2 -5
- numcodecs/ndarray_like.py +4 -4
- numcodecs/packbits.py +0 -1
- numcodecs/pcodec.py +2 -2
- numcodecs/pickles.py +1 -1
- numcodecs/quantize.py +4 -10
- numcodecs/registry.py +2 -2
- numcodecs/shuffle.py +4 -4
- numcodecs/tests/common.py +7 -11
- numcodecs/tests/test_astype.py +2 -4
- numcodecs/tests/test_base64.py +2 -5
- numcodecs/tests/test_bitround.py +0 -1
- numcodecs/tests/test_blosc.py +2 -5
- numcodecs/tests/test_bz2.py +3 -6
- numcodecs/tests/test_categorize.py +3 -5
- numcodecs/tests/test_checksum32.py +3 -6
- numcodecs/tests/test_compat.py +1 -3
- numcodecs/tests/test_delta.py +3 -5
- numcodecs/tests/test_entrypoints.py +0 -1
- numcodecs/tests/test_entrypoints_backport.py +3 -4
- numcodecs/tests/test_fixedscaleoffset.py +3 -6
- numcodecs/tests/test_gzip.py +3 -6
- numcodecs/tests/test_jenkins.py +33 -33
- numcodecs/tests/test_json.py +2 -2
- numcodecs/tests/test_lz4.py +3 -6
- numcodecs/tests/test_lzma.py +5 -8
- numcodecs/tests/test_msgpacks.py +4 -7
- numcodecs/tests/test_packbits.py +2 -4
- numcodecs/tests/test_pcodec.py +4 -5
- numcodecs/tests/test_pickles.py +2 -3
- numcodecs/tests/test_quantize.py +3 -6
- numcodecs/tests/test_registry.py +4 -4
- numcodecs/tests/test_shuffle.py +2 -5
- numcodecs/tests/test_vlen_array.py +5 -6
- numcodecs/tests/test_vlen_bytes.py +5 -6
- numcodecs/tests/test_vlen_utf8.py +5 -8
- numcodecs/tests/test_zfpy.py +4 -8
- numcodecs/tests/test_zlib.py +4 -7
- numcodecs/tests/test_zstd.py +6 -9
- numcodecs/version.py +2 -2
- numcodecs/vlen.cp311-win_amd64.pyd +0 -0
- numcodecs/zfpy.py +9 -10
- numcodecs/zlib.py +1 -2
- numcodecs/zstd.cp311-win_amd64.pyd +0 -0
- {numcodecs-0.13.0.dist-info → numcodecs-0.13.1.dist-info}/METADATA +3 -3
- numcodecs-0.13.1.dist-info/RECORD +74 -0
- {numcodecs-0.13.0.dist-info → numcodecs-0.13.1.dist-info}/WHEEL +1 -1
- numcodecs-0.13.0.dist-info/RECORD +0 -74
- {numcodecs-0.13.0.dist-info → numcodecs-0.13.1.dist-info}/LICENSE.txt +0 -0
- {numcodecs-0.13.0.dist-info → numcodecs-0.13.1.dist-info}/top_level.txt +0 -0
numcodecs/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ruff: noqa: E402,F401
|
|
2
2
|
"""Numcodecs is a Python package providing buffer compression and
|
|
3
3
|
transformation codecs for use in data storage and communication
|
|
4
4
|
applications. These include:
|
|
@@ -17,14 +17,12 @@ contribute code, please `raise an issue on GitHub
|
|
|
17
17
|
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
|
-
import multiprocessing
|
|
21
20
|
import atexit
|
|
21
|
+
import multiprocessing
|
|
22
22
|
from contextlib import suppress
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
from numcodecs.version import version as __version__
|
|
26
24
|
from numcodecs.registry import get_codec, register_codec
|
|
27
|
-
|
|
25
|
+
from numcodecs.version import version as __version__
|
|
28
26
|
from numcodecs.zlib import Zlib
|
|
29
27
|
|
|
30
28
|
register_codec(Zlib)
|
|
@@ -130,7 +128,7 @@ register_codec(JSON)
|
|
|
130
128
|
|
|
131
129
|
with suppress(ImportError):
|
|
132
130
|
from numcodecs import vlen
|
|
133
|
-
from numcodecs.vlen import
|
|
131
|
+
from numcodecs.vlen import VLenArray, VLenBytes, VLenUTF8
|
|
134
132
|
|
|
135
133
|
register_codec(VLenUTF8)
|
|
136
134
|
register_codec(VLenBytes)
|
|
Binary file
|
numcodecs/abc.py
CHANGED
|
@@ -118,11 +118,9 @@ class Codec(ABC):
|
|
|
118
118
|
# by default, assume all non-private members are configuration
|
|
119
119
|
# parameters and valid keyword arguments to constructor function
|
|
120
120
|
|
|
121
|
-
r = '
|
|
121
|
+
r = f'{type(self).__name__}('
|
|
122
122
|
params = [
|
|
123
|
-
'{}={!r}'
|
|
124
|
-
for k in sorted(self.__dict__)
|
|
125
|
-
if not k.startswith('_')
|
|
123
|
+
f'{k}={getattr(self, k)!r}' for k in sorted(self.__dict__) if not k.startswith('_')
|
|
126
124
|
]
|
|
127
125
|
r += ', '.join(params) + ')'
|
|
128
126
|
return r
|
numcodecs/astype.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
|
|
3
3
|
from .abc import Codec
|
|
4
|
-
from .compat import
|
|
4
|
+
from .compat import ensure_ndarray, ndarray_copy
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class AsType(Codec):
|
|
@@ -73,6 +73,4 @@ class AsType(Codec):
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
def __repr__(self):
|
|
76
|
-
return '{}(encode_dtype={!r}, decode_dtype={!r})'
|
|
77
|
-
type(self).__name__, self.encode_dtype.str, self.decode_dtype.str
|
|
78
|
-
)
|
|
76
|
+
return f'{type(self).__name__}(encode_dtype={self.encode_dtype.str!r}, decode_dtype={self.decode_dtype.str!r})'
|
numcodecs/bitround.py
CHANGED
|
Binary file
|
numcodecs/bz2.py
CHANGED
numcodecs/categorize.py
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from .abc import Codec
|
|
2
|
-
from .compat import ensure_ndarray, ndarray_copy, ensure_text
|
|
3
|
-
|
|
4
|
-
|
|
5
1
|
import numpy as np
|
|
6
2
|
|
|
3
|
+
from .abc import Codec
|
|
4
|
+
from .compat import ensure_ndarray, ensure_text, ndarray_copy
|
|
5
|
+
|
|
7
6
|
|
|
8
7
|
class Categorize(Codec):
|
|
9
8
|
"""Filter encoding categorical string data as integers.
|
|
@@ -41,7 +40,7 @@ class Categorize(Codec):
|
|
|
41
40
|
def __init__(self, labels, dtype, astype='u1'):
|
|
42
41
|
self.dtype = np.dtype(dtype)
|
|
43
42
|
if self.dtype.kind not in 'UO':
|
|
44
|
-
raise TypeError("only unicode ('U') and object ('O') dtypes are
|
|
43
|
+
raise TypeError("only unicode ('U') and object ('O') dtypes are supported")
|
|
45
44
|
self.labels = [ensure_text(label) for label in labels]
|
|
46
45
|
self.astype = np.dtype(astype)
|
|
47
46
|
if self.astype == np.dtype(object):
|
|
@@ -99,10 +98,4 @@ class Categorize(Codec):
|
|
|
99
98
|
labels = repr(self.labels[:3])
|
|
100
99
|
if len(self.labels) > 3:
|
|
101
100
|
labels = labels[:-1] + ', ...]'
|
|
102
|
-
|
|
103
|
-
type(self).__name__,
|
|
104
|
-
self.dtype.str,
|
|
105
|
-
self.astype.str,
|
|
106
|
-
labels,
|
|
107
|
-
)
|
|
108
|
-
return r
|
|
101
|
+
return f'{type(self).__name__}(dtype={self.dtype.str!r}, astype={self.astype.str!r}, labels={labels})'
|
numcodecs/checksum32.py
CHANGED
numcodecs/compat.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
#
|
|
2
|
-
import functools
|
|
3
|
-
import sys
|
|
4
|
-
import codecs
|
|
1
|
+
# ruff: noqa: F401
|
|
5
2
|
import array
|
|
6
|
-
|
|
3
|
+
import codecs
|
|
4
|
+
import functools
|
|
7
5
|
|
|
8
6
|
import numpy as np
|
|
9
7
|
|
|
@@ -115,7 +113,7 @@ def ensure_contiguous_ndarray_like(buf, max_buffer_size=None, flatten=True) -> N
|
|
|
115
113
|
raise ValueError("an array with contiguous memory is required")
|
|
116
114
|
|
|
117
115
|
if max_buffer_size is not None and arr.nbytes > max_buffer_size:
|
|
118
|
-
msg = "Codec does not support buffers of > {} bytes"
|
|
116
|
+
msg = f"Codec does not support buffers of > {max_buffer_size} bytes"
|
|
119
117
|
raise ValueError(msg)
|
|
120
118
|
|
|
121
119
|
return arr
|
|
Binary file
|
numcodecs/delta.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
from .abc import Codec
|
|
5
4
|
from .compat import ensure_ndarray, ndarray_copy
|
|
6
5
|
|
|
@@ -91,8 +90,8 @@ class Delta(Codec):
|
|
|
91
90
|
return dict(id=self.codec_id, dtype=self.dtype.str, astype=self.astype.str)
|
|
92
91
|
|
|
93
92
|
def __repr__(self):
|
|
94
|
-
r = '{
|
|
93
|
+
r = f'{type(self).__name__}(dtype={self.dtype.str!r}'
|
|
95
94
|
if self.astype != self.dtype:
|
|
96
|
-
r += ', astype
|
|
95
|
+
r += f', astype={self.astype.str!r}'
|
|
97
96
|
r += ')'
|
|
98
97
|
return r
|
numcodecs/fixedscaleoffset.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
from .abc import Codec
|
|
5
4
|
from .compat import ensure_ndarray, ndarray_copy
|
|
6
5
|
|
|
@@ -15,7 +14,7 @@ class FixedScaleOffset(Codec):
|
|
|
15
14
|
----------
|
|
16
15
|
offset : float
|
|
17
16
|
Value to subtract from data.
|
|
18
|
-
scale :
|
|
17
|
+
scale : float
|
|
19
18
|
Value to multiply by data.
|
|
20
19
|
dtype : dtype
|
|
21
20
|
Data type to use for decoded data.
|
|
@@ -126,13 +125,8 @@ class FixedScaleOffset(Codec):
|
|
|
126
125
|
)
|
|
127
126
|
|
|
128
127
|
def __repr__(self):
|
|
129
|
-
r = '
|
|
130
|
-
type(self).__name__,
|
|
131
|
-
self.scale,
|
|
132
|
-
self.offset,
|
|
133
|
-
self.dtype.str,
|
|
134
|
-
)
|
|
128
|
+
r = f'{type(self).__name__}(scale={self.scale}, offset={self.offset}, dtype={self.dtype.str!r}'
|
|
135
129
|
if self.astype != self.dtype:
|
|
136
|
-
r += ', astype
|
|
130
|
+
r += f', astype={self.astype.str!r}'
|
|
137
131
|
r += ')'
|
|
138
132
|
return r
|
|
Binary file
|
|
Binary file
|
numcodecs/json.py
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import json as _json
|
|
2
2
|
import textwrap
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
import numpy as np
|
|
6
5
|
|
|
7
|
-
|
|
8
6
|
from .abc import Codec
|
|
9
7
|
from .compat import ensure_text
|
|
10
8
|
|
|
@@ -97,12 +95,13 @@ class JSON(Codec):
|
|
|
97
95
|
return config
|
|
98
96
|
|
|
99
97
|
def __repr__(self):
|
|
100
|
-
params = ['encoding
|
|
98
|
+
params = [f'encoding={self._text_encoding!r}']
|
|
101
99
|
for k, v in sorted(self._encoder_config.items()):
|
|
102
|
-
params.append('{}={!r}'
|
|
100
|
+
params.append(f'{k}={v!r}')
|
|
103
101
|
for k, v in sorted(self._decoder_config.items()):
|
|
104
|
-
params.append('{}={!r}'
|
|
102
|
+
params.append(f'{k}={v!r}')
|
|
105
103
|
classname = type(self).__name__
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
params = ', '.join(params)
|
|
105
|
+
return textwrap.fill(
|
|
106
|
+
f'{classname}({params})', width=80, break_long_words=False, subsequent_indent=' '
|
|
107
|
+
)
|
|
Binary file
|
numcodecs/lzma.py
CHANGED
|
@@ -10,7 +10,7 @@ except ImportError: # pragma: no cover
|
|
|
10
10
|
|
|
11
11
|
if _lzma:
|
|
12
12
|
from .abc import Codec
|
|
13
|
-
from .compat import
|
|
13
|
+
from .compat import ensure_contiguous_ndarray, ndarray_copy
|
|
14
14
|
|
|
15
15
|
# noinspection PyShadowingBuiltins
|
|
16
16
|
class LZMA(Codec):
|
|
@@ -66,11 +66,4 @@ if _lzma:
|
|
|
66
66
|
return ndarray_copy(dec, out)
|
|
67
67
|
|
|
68
68
|
def __repr__(self):
|
|
69
|
-
|
|
70
|
-
type(self).__name__,
|
|
71
|
-
self.format,
|
|
72
|
-
self.check,
|
|
73
|
-
self.preset,
|
|
74
|
-
self.filters,
|
|
75
|
-
)
|
|
76
|
-
return r
|
|
69
|
+
return f'{type(self).__name__}(format={self.format!r}, check={self.check!r}, preset={self.preset!r}, filters={self.filters!r})'
|
numcodecs/msgpacks.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import numpy as np
|
|
2
1
|
import msgpack
|
|
3
|
-
|
|
2
|
+
import numpy as np
|
|
4
3
|
|
|
5
4
|
from .abc import Codec
|
|
6
5
|
from .compat import ensure_contiguous_ndarray
|
|
@@ -84,6 +83,4 @@ class MsgPack(Codec):
|
|
|
84
83
|
)
|
|
85
84
|
|
|
86
85
|
def __repr__(self):
|
|
87
|
-
return 'MsgPack(raw={!r}, use_bin_type={!r}, use_single_float={!r})'
|
|
88
|
-
self.raw, self.use_bin_type, self.use_single_float
|
|
89
|
-
)
|
|
86
|
+
return f'MsgPack(raw={self.raw!r}, use_bin_type={self.use_bin_type!r}, use_single_float={self.use_single_float!r})'
|
numcodecs/ndarray_like.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any,
|
|
1
|
+
from typing import Any, ClassVar, Optional, Protocol, runtime_checkable
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class _CachedProtocolMeta(Protocol.__class__):
|
|
@@ -11,7 +11,7 @@ class _CachedProtocolMeta(Protocol.__class__):
|
|
|
11
11
|
isinstance checks using the object's class as the cache key.
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
-
_instancecheck_cache:
|
|
14
|
+
_instancecheck_cache: ClassVar[dict[tuple[type, type], bool]] = {}
|
|
15
15
|
|
|
16
16
|
def __instancecheck__(self, instance):
|
|
17
17
|
key = (self, instance.__class__)
|
|
@@ -39,8 +39,8 @@ class FlagsObj(Protocol, metaclass=_CachedProtocolMeta):
|
|
|
39
39
|
@runtime_checkable
|
|
40
40
|
class NDArrayLike(Protocol, metaclass=_CachedProtocolMeta):
|
|
41
41
|
dtype: DType
|
|
42
|
-
shape:
|
|
43
|
-
strides:
|
|
42
|
+
shape: tuple[int, ...]
|
|
43
|
+
strides: tuple[int, ...]
|
|
44
44
|
ndim: int
|
|
45
45
|
size: int
|
|
46
46
|
itemsize: int
|
numcodecs/packbits.py
CHANGED
numcodecs/pcodec.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Literal, Optional
|
|
2
2
|
|
|
3
3
|
import numcodecs
|
|
4
4
|
import numcodecs.abc
|
|
5
5
|
from numcodecs.compat import ensure_contiguous_ndarray
|
|
6
6
|
|
|
7
7
|
try:
|
|
8
|
-
from pcodec import
|
|
8
|
+
from pcodec import ChunkConfig, ModeSpec, PagingSpec, standalone
|
|
9
9
|
except ImportError: # pragma: no cover
|
|
10
10
|
standalone = None
|
|
11
11
|
|
numcodecs/pickles.py
CHANGED
numcodecs/quantize.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import math
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
import numpy as np
|
|
5
4
|
|
|
6
|
-
|
|
7
5
|
from .abc import Codec
|
|
8
6
|
from .compat import ensure_ndarray, ndarray_copy
|
|
9
7
|
|
|
@@ -65,12 +63,12 @@ class Quantize(Codec):
|
|
|
65
63
|
|
|
66
64
|
# apply scaling
|
|
67
65
|
precision = 10.0**-self.digits
|
|
68
|
-
exp = math.
|
|
66
|
+
exp = math.log10(precision)
|
|
69
67
|
if exp < 0:
|
|
70
68
|
exp = int(math.floor(exp))
|
|
71
69
|
else:
|
|
72
70
|
exp = int(math.ceil(exp))
|
|
73
|
-
bits = math.ceil(math.
|
|
71
|
+
bits = math.ceil(math.log2(10.0**-exp))
|
|
74
72
|
scale = 2.0**bits
|
|
75
73
|
enc = np.around(scale * arr) / scale
|
|
76
74
|
|
|
@@ -95,12 +93,8 @@ class Quantize(Codec):
|
|
|
95
93
|
)
|
|
96
94
|
|
|
97
95
|
def __repr__(self):
|
|
98
|
-
r = '
|
|
99
|
-
type(self).__name__,
|
|
100
|
-
self.digits,
|
|
101
|
-
self.dtype.str,
|
|
102
|
-
)
|
|
96
|
+
r = f'{type(self).__name__}(digits={self.digits}, dtype={self.dtype.str!r}'
|
|
103
97
|
if self.astype != self.dtype:
|
|
104
|
-
r += ', astype
|
|
98
|
+
r += f', astype={self.astype.str!r}'
|
|
105
99
|
r += ')'
|
|
106
100
|
return r
|
numcodecs/registry.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""The registry module provides some simple convenience functions to enable
|
|
2
2
|
applications to dynamically register and look-up codec classes."""
|
|
3
3
|
|
|
4
|
-
from importlib.metadata import entry_points
|
|
5
4
|
import logging
|
|
5
|
+
from importlib.metadata import entry_points
|
|
6
6
|
|
|
7
7
|
logger = logging.getLogger("numcodecs")
|
|
8
8
|
codec_registry = {}
|
|
@@ -49,7 +49,7 @@ def get_codec(config):
|
|
|
49
49
|
register_codec(cls, codec_id=codec_id)
|
|
50
50
|
if cls:
|
|
51
51
|
return cls.from_config(config)
|
|
52
|
-
raise ValueError('codec not available:
|
|
52
|
+
raise ValueError(f'codec not available: {codec_id!r}')
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def register_codec(cls, codec_id=None):
|
numcodecs/shuffle.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
-
|
|
3
|
-
from .abc import Codec
|
|
2
|
+
|
|
4
3
|
from ._shuffle import _doShuffle, _doUnshuffle
|
|
4
|
+
from .abc import Codec
|
|
5
|
+
from .compat import ensure_contiguous_ndarray
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class Shuffle(Codec):
|
|
@@ -57,5 +58,4 @@ class Shuffle(Codec):
|
|
|
57
58
|
return out
|
|
58
59
|
|
|
59
60
|
def __repr__(self):
|
|
60
|
-
|
|
61
|
-
return r
|
|
61
|
+
return f'{type(self).__name__}(elementsize={self.elementsize})'
|
numcodecs/tests/common.py
CHANGED
|
@@ -3,19 +3,15 @@ import json as _json
|
|
|
3
3
|
import os
|
|
4
4
|
from glob import glob
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
import numpy as np
|
|
8
|
-
from numpy.testing import assert_array_almost_equal, assert_array_equal
|
|
9
7
|
import pytest
|
|
8
|
+
from numpy.testing import assert_array_almost_equal, assert_array_equal
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
# star import needed for repr tests so eval finds names
|
|
11
|
+
from numcodecs import * # noqa: F403
|
|
12
12
|
from numcodecs.compat import ensure_bytes, ensure_ndarray
|
|
13
13
|
from numcodecs.registry import get_codec
|
|
14
14
|
|
|
15
|
-
# star import needed for repr tests so eval finds names
|
|
16
|
-
from numcodecs import * # noqa
|
|
17
|
-
|
|
18
|
-
|
|
19
15
|
greetings = [
|
|
20
16
|
'¡Hola mundo!',
|
|
21
17
|
'Hej Världen!',
|
|
@@ -200,7 +196,7 @@ def assert_array_items_equal(res, arr):
|
|
|
200
196
|
# and values
|
|
201
197
|
arr = arr.ravel().tolist()
|
|
202
198
|
res = res.ravel().tolist()
|
|
203
|
-
for a, r in zip(arr, res):
|
|
199
|
+
for a, r in zip(arr, res, strict=True):
|
|
204
200
|
if isinstance(a, np.ndarray):
|
|
205
201
|
assert_array_equal(a, r)
|
|
206
202
|
elif a != a:
|
|
@@ -258,7 +254,7 @@ def check_backwards_compatibility(codec_id, arrays, codecs, precision=None, pref
|
|
|
258
254
|
|
|
259
255
|
# save fixture data
|
|
260
256
|
for i, arr in enumerate(arrays):
|
|
261
|
-
arr_fn = os.path.join(fixture_dir, 'array.{:02d}.npy'
|
|
257
|
+
arr_fn = os.path.join(fixture_dir, f'array.{i:02d}.npy')
|
|
262
258
|
if not os.path.exists(arr_fn): # pragma: no cover
|
|
263
259
|
np.save(arr_fn, arr)
|
|
264
260
|
|
|
@@ -278,7 +274,7 @@ def check_backwards_compatibility(codec_id, arrays, codecs, precision=None, pref
|
|
|
278
274
|
pytest.skip("codec has been removed")
|
|
279
275
|
|
|
280
276
|
# setup a directory to hold encoded data
|
|
281
|
-
codec_dir = os.path.join(fixture_dir, 'codec.{:02d}'
|
|
277
|
+
codec_dir = os.path.join(fixture_dir, f'codec.{j:02d}')
|
|
282
278
|
if not os.path.exists(codec_dir): # pragma: no cover
|
|
283
279
|
os.makedirs(codec_dir)
|
|
284
280
|
|
|
@@ -293,7 +289,7 @@ def check_backwards_compatibility(codec_id, arrays, codecs, precision=None, pref
|
|
|
293
289
|
config = _json.load(cf)
|
|
294
290
|
assert codec == get_codec(config)
|
|
295
291
|
|
|
296
|
-
enc_fn = os.path.join(codec_dir, 'encoded.{:02d}.dat'
|
|
292
|
+
enc_fn = os.path.join(codec_dir, f'encoded.{i:02d}.dat')
|
|
297
293
|
|
|
298
294
|
# one time encode and save array
|
|
299
295
|
if not os.path.exists(enc_fn): # pragma: no cover
|
numcodecs/tests/test_astype.py
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
from numpy.testing import assert_array_equal
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
from numcodecs.astype import AsType
|
|
6
5
|
from numcodecs.tests.common import (
|
|
7
|
-
|
|
6
|
+
check_backwards_compatibility,
|
|
8
7
|
check_config,
|
|
8
|
+
check_encode_decode,
|
|
9
9
|
check_repr,
|
|
10
|
-
check_backwards_compatibility,
|
|
11
10
|
)
|
|
12
11
|
|
|
13
|
-
|
|
14
12
|
# mix of dtypes: integer, float
|
|
15
13
|
# mix of shapes: 1D, 2D, 3D
|
|
16
14
|
# mix of orders: C, F
|
numcodecs/tests/test_base64.py
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import itertools
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
import numpy as np
|
|
5
4
|
import pytest
|
|
6
5
|
|
|
7
|
-
|
|
8
6
|
from numcodecs.base64 import Base64
|
|
9
7
|
from numcodecs.tests.common import (
|
|
10
|
-
check_encode_decode,
|
|
11
|
-
check_repr,
|
|
12
8
|
check_backwards_compatibility,
|
|
9
|
+
check_encode_decode,
|
|
13
10
|
check_err_decode_object_buffer,
|
|
14
11
|
check_err_encode_object_buffer,
|
|
12
|
+
check_repr,
|
|
15
13
|
)
|
|
16
14
|
|
|
17
|
-
|
|
18
15
|
codecs = [
|
|
19
16
|
Base64(),
|
|
20
17
|
]
|
numcodecs/tests/test_bitround.py
CHANGED
numcodecs/tests/test_blosc.py
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
from multiprocessing import Pool
|
|
2
2
|
from multiprocessing.pool import ThreadPool
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
import numpy as np
|
|
6
5
|
import pytest
|
|
7
6
|
|
|
8
|
-
|
|
9
7
|
try:
|
|
10
8
|
from numcodecs import blosc
|
|
11
9
|
from numcodecs.blosc import Blosc
|
|
@@ -14,16 +12,15 @@ except ImportError: # pragma: no cover
|
|
|
14
12
|
|
|
15
13
|
|
|
16
14
|
from numcodecs.tests.common import (
|
|
15
|
+
check_backwards_compatibility,
|
|
16
|
+
check_config,
|
|
17
17
|
check_encode_decode,
|
|
18
18
|
check_encode_decode_partial,
|
|
19
|
-
check_config,
|
|
20
|
-
check_backwards_compatibility,
|
|
21
19
|
check_err_decode_object_buffer,
|
|
22
20
|
check_err_encode_object_buffer,
|
|
23
21
|
check_max_buffer_size,
|
|
24
22
|
)
|
|
25
23
|
|
|
26
|
-
|
|
27
24
|
codecs = [
|
|
28
25
|
Blosc(shuffle=Blosc.SHUFFLE),
|
|
29
26
|
Blosc(clevel=0, shuffle=Blosc.SHUFFLE),
|
numcodecs/tests/test_bz2.py
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import itertools
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
import numpy as np
|
|
5
4
|
|
|
6
|
-
|
|
7
5
|
from numcodecs.bz2 import BZ2
|
|
8
6
|
from numcodecs.tests.common import (
|
|
9
|
-
check_encode_decode,
|
|
10
|
-
check_config,
|
|
11
|
-
check_repr,
|
|
12
7
|
check_backwards_compatibility,
|
|
8
|
+
check_config,
|
|
9
|
+
check_encode_decode,
|
|
13
10
|
check_err_decode_object_buffer,
|
|
14
11
|
check_err_encode_object_buffer,
|
|
12
|
+
check_repr,
|
|
15
13
|
)
|
|
16
14
|
|
|
17
|
-
|
|
18
15
|
codecs = [
|
|
19
16
|
BZ2(),
|
|
20
17
|
BZ2(level=1),
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
-
from numpy.testing import assert_array_equal
|
|
3
2
|
import pytest
|
|
4
|
-
|
|
3
|
+
from numpy.testing import assert_array_equal
|
|
5
4
|
|
|
6
5
|
from numcodecs.categorize import Categorize
|
|
7
6
|
from numcodecs.tests.common import (
|
|
8
|
-
check_encode_decode,
|
|
9
|
-
check_config,
|
|
10
7
|
check_backwards_compatibility,
|
|
8
|
+
check_config,
|
|
9
|
+
check_encode_decode,
|
|
11
10
|
check_encode_decode_array,
|
|
12
11
|
)
|
|
13
12
|
|
|
14
|
-
|
|
15
13
|
labels = ['ƒöõ', 'ßàř', 'ßāẑ', 'ƪùüx']
|
|
16
14
|
arrays = [
|
|
17
15
|
np.random.choice(labels, size=1000),
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import itertools
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
import numpy as np
|
|
5
4
|
import pytest
|
|
6
5
|
|
|
7
|
-
|
|
8
6
|
from numcodecs.checksum32 import CRC32, Adler32
|
|
9
7
|
from numcodecs.tests.common import (
|
|
10
|
-
check_encode_decode,
|
|
11
|
-
check_config,
|
|
12
|
-
check_repr,
|
|
13
8
|
check_backwards_compatibility,
|
|
9
|
+
check_config,
|
|
10
|
+
check_encode_decode,
|
|
14
11
|
check_err_encode_object_buffer,
|
|
12
|
+
check_repr,
|
|
15
13
|
)
|
|
16
14
|
|
|
17
|
-
|
|
18
15
|
# mix of dtypes: integer, float, bool, string
|
|
19
16
|
# mix of shapes: 1D, 2D, 3D
|
|
20
17
|
# mix of orders: C, F
|
numcodecs/tests/test_compat.py
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import array
|
|
2
2
|
import mmap
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
import numpy as np
|
|
6
5
|
import pytest
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
from numcodecs.compat import ensure_text, ensure_bytes, ensure_contiguous_ndarray
|
|
7
|
+
from numcodecs.compat import ensure_bytes, ensure_contiguous_ndarray, ensure_text
|
|
10
8
|
|
|
11
9
|
|
|
12
10
|
def test_ensure_text():
|
numcodecs/tests/test_delta.py
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
-
from numpy.testing import assert_array_equal
|
|
3
2
|
import pytest
|
|
4
|
-
|
|
3
|
+
from numpy.testing import assert_array_equal
|
|
5
4
|
|
|
6
5
|
from numcodecs.delta import Delta
|
|
7
6
|
from numcodecs.tests.common import (
|
|
8
|
-
|
|
7
|
+
check_backwards_compatibility,
|
|
9
8
|
check_config,
|
|
9
|
+
check_encode_decode,
|
|
10
10
|
check_repr,
|
|
11
|
-
check_backwards_compatibility,
|
|
12
11
|
)
|
|
13
12
|
|
|
14
|
-
|
|
15
13
|
# mix of dtypes: integer, float
|
|
16
14
|
# mix of shapes: 1D, 2D, 3D
|
|
17
15
|
# mix of orders: C, F
|