Skip to content

Commit 1072b2a

Browse files
authored
Merge branch 'main' into patch-1
2 parents 4976a29 + 095de5c commit 1072b2a

19 files changed

+76
-85
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
exclude: ^fixture/ # files with trailing whitespaces on purpose
22
ci:
33
autoupdate_commit_msg: "chore: update pre-commit hooks"
4+
autoupdate_schedule: "monthly"
45
autofix_commit_msg: "style: pre-commit fixes"
56
autofix_prs: false
67
default_stages: [pre-commit, pre-push]
7-
default_language_version:
8-
python: python3
98
repos:
109
- repo: https://github.com/pre-commit/pre-commit-hooks
1110
rev: v5.0.0
@@ -27,7 +26,7 @@ repos:
2726
- id: sp-repo-review
2827

2928
- repo: https://github.com/pre-commit/mirrors-mypy
30-
rev: 'v1.14.0'
29+
rev: v1.14.0
3130
hooks:
3231
- id: mypy
3332
args: [--config-file, pyproject.toml]

adhoc/blosc_memleak_check.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import sys
22

3+
import numcodecs
34
import numpy as np
45
from numpy.testing import assert_array_equal
56

6-
import numcodecs
7-
87
codec = numcodecs.Blosc()
98
data = np.arange(int(sys.argv[1]))
109
for _ in range(int(sys.argv[2])):

notebooks/benchmark_vlen.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424
}
2525
],
2626
"source": [
27-
"import numpy as np\n",
28-
"\n",
2927
"import numcodecs\n",
28+
"import numpy as np\n",
3029
"\n",
3130
"numcodecs.__version__"
3231
]

numcodecs/astype.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ def encode(self, buf):
4949
arr = ensure_ndarray(buf).view(self.decode_dtype)
5050

5151
# convert and copy
52-
enc = arr.astype(self.encode_dtype)
53-
54-
return enc
52+
return arr.astype(self.encode_dtype)
5553

5654
def decode(self, buf, out=None):
5755
# normalise input
@@ -61,9 +59,7 @@ def decode(self, buf, out=None):
6159
dec = enc.astype(self.decode_dtype)
6260

6361
# handle output
64-
out = ndarray_copy(dec, out)
65-
66-
return out
62+
return ndarray_copy(dec, out)
6763

6864
def get_config(self):
6965
return {

numcodecs/base64.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ def encode(self, buf):
1313
# normalise inputs
1414
buf = ensure_contiguous_ndarray(buf)
1515
# do compression
16-
compressed = _base64.standard_b64encode(buf)
17-
return compressed
16+
return _base64.standard_b64encode(buf)
1817

1918
def decode(self, buf, out=None):
2019
# normalise inputs

numcodecs/categorize.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,15 @@ def decode(self, buf, out=None):
8080
dec[enc == (i + 1)] = label
8181

8282
# handle output
83-
dec = ndarray_copy(dec, out)
84-
85-
return dec
83+
return ndarray_copy(dec, out)
8684

8785
def get_config(self):
88-
config = {
86+
return {
8987
'id': self.codec_id,
9088
'labels': self.labels,
9189
'dtype': self.dtype.str,
9290
'astype': self.astype.str,
9391
}
94-
return config
9592

9693
def __repr__(self):
9794
# make sure labels part is not too long

numcodecs/delta.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ def decode(self, buf, out=None):
8585
np.cumsum(enc, out=dec)
8686

8787
# handle output
88-
out = ndarray_copy(dec, out)
89-
90-
return out
88+
return ndarray_copy(dec, out)
9189

9290
def get_config(self):
9391
# override to handle encoding dtypes

numcodecs/fixedscaleoffset.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ def encode(self, buf):
9494
enc = np.around(enc)
9595

9696
# convert dtype
97-
enc = enc.astype(self.astype, copy=False)
98-
99-
return enc
97+
return enc.astype(self.astype, copy=False)
10098

10199
def decode(self, buf, out=None):
102100
# interpret buffer as numpy array

numcodecs/gzip.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ def encode(self, buf):
2828
compressed = io.BytesIO()
2929
with _gzip.GzipFile(fileobj=compressed, mode='wb', compresslevel=self.level) as compressor:
3030
compressor.write(buf)
31-
compressed = compressed.getvalue()
32-
33-
return compressed
31+
return compressed.getvalue()
3432

3533
# noinspection PyMethodMayBeStatic
3634
def decode(self, buf, out=None):

numcodecs/lzma.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
try:
66
import lzma as _lzma
77
except ImportError: # pragma: no cover
8-
try:
8+
try: # noqa: SIM105
99
from backports import lzma as _lzma # type: ignore[no-redef]
1010
except ImportError:
1111
pass

0 commit comments

Comments
 (0)