Skip to content

Commit 8edd3f9

Browse files
Apply repo-review suggestions (#559)
* Apply repo-review rule PP304 PP304: Sets the log level in pytest log_cli_level should be set. This will allow logs to be displayed on failures. * Apply repo-review rule PP305 PP305: Specifies xfail_strict xfail_strict should be set. You can manually specify if a check should be strict when setting each xfail. * Apply repo-review rules PP306, PP307, PP308 PP306: Specifies strict config --strict-config should be in addopts = [...]. This forces an error if a config setting is misspelled. PP307: Specifies strict markers --strict-markers should be in addopts = [...]. This forces all markers to be specified in config, avoiding misspellings. PP308: Specifies useful pytest summary An explicit summary flag like -ra should be in addopts = [...] (print summary of all fails/errors). * Apply ruff/pygrep-hooks rule PGH004 PGH004 Use specific rule codes when using `noqa` PGH004 Use specific rule codes when using `ruff: noqa` * Apply and enforce ruff rules (RUF) Apply ruff rule RUF012: RUF012 Mutable class attributes should be annotated with `typing.ClassVar` Disable ruff rule RUF001 * Apply and enforce ruff/flake8-bugbear rules (B) B007 Loop control variable not used within loop body B028 No explicit `stacklevel` keyword argument found B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling B905 `zip()` without an explicit `strict=` parameter Co-authored-by: David Stansby <[email protected]> * Apply and enforce ruff/isort rules (I) * Apply repo-review rule PC100 PC100: Has pre-commit-hooks Must have https://github.com/pre-commit/pre-commit-hooks repo in .pre-commit-config.yaml * Enforce repo-review rules * Apply ruff/flake8-implicit-str-concat rules (ISC) ISC001 Implicitly concatenated string literals on one line ISC003 Explicitly concatenated string should be implicitly concatenated * Apply ruff/refurb rules (FURB) FURB163 Prefer `math.log10`/`math.log2` over `math.log` with a redundant base * Fix DeprecationWarning 'pkgutil.find_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec() instead --------- Co-authored-by: David Stansby <[email protected]>
1 parent 3652eb1 commit 8edd3f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+194
-254
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
exclude: ^fixture/ # files with trailing whitespaces on purpose
12
ci:
23
autoupdate_commit_msg: "chore: update pre-commit hooks"
34
autofix_commit_msg: "style: pre-commit fixes"
@@ -6,9 +7,21 @@ default_stages: [commit, push]
67
default_language_version:
78
python: python3
89
repos:
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v4.6.0
12+
hooks:
13+
- id: trailing-whitespace
14+
- id: check-yaml
15+
- id: debug-statements
16+
917
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: 'v0.6.9'
18+
rev: v0.6.9
1119
hooks:
1220
- id: ruff
1321
args: ["--fix", "--show-fixes"]
1422
- id: ruff-format
23+
24+
- repo: https://github.com/scientific-python/cookie
25+
rev: 2024.04.23
26+
hooks:
27+
- id: sp-repo-review

.pyup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# autogenerated pyup.io config file
1+
# autogenerated pyup.io config file
22
# see https://pyup.io/docs/configuration/ for all available options
33

44
schedule: every month

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Numcodecs
22
=========
33

4-
Numcodecs is a Python package providing buffer compression and transformation
4+
Numcodecs is a Python package providing buffer compression and transformation
55
codecs for use in data storage and communication applications.
66

77
.. image:: https://readthedocs.org/projects/numcodecs/badge/?version=latest

adhoc/blosc_memleak_check.py

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

3-
import numcodecs
43
import numpy as np
54
from numpy.testing import assert_array_equal
65

6+
import numcodecs
77

88
codec = numcodecs.Blosc()
99
data = np.arange(int(sys.argv[1]))
10-
for i in range(int(sys.argv[2])):
10+
for _ in range(int(sys.argv[2])):
1111
enc = codec.encode(data)
1212
dec = codec.decode(enc)
1313
arr = np.frombuffer(dec, dtype=data.dtype)

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
# serve to show the default.
1414

1515

16-
import sys
1716
import os
17+
import sys
1818
from unittest.mock import Mock as MagicMock
19+
1920
import numcodecs
2021

2122

notebooks/benchmark_vlen.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
],
2626
"source": [
2727
"import numpy as np\n",
28+
"\n",
2829
"import numcodecs\n",
2930
"\n",
3031
"numcodecs.__version__"

numcodecs/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# flake8: noqa
1+
# ruff: noqa: E402,F401
22
"""Numcodecs is a Python package providing buffer compression and
33
transformation codecs for use in data storage and communication
44
applications. These include:
@@ -17,14 +17,12 @@
1717
1818
"""
1919

20-
import multiprocessing
2120
import atexit
21+
import multiprocessing
2222
from contextlib import suppress
2323

24-
25-
from numcodecs.version import version as __version__
2624
from numcodecs.registry import get_codec, register_codec
27-
25+
from numcodecs.version import version as __version__
2826
from numcodecs.zlib import Zlib
2927

3028
register_codec(Zlib)
@@ -130,7 +128,7 @@
130128

131129
with suppress(ImportError):
132130
from numcodecs import vlen
133-
from numcodecs.vlen import VLenUTF8, VLenBytes, VLenArray
131+
from numcodecs.vlen import VLenArray, VLenBytes, VLenUTF8
134132

135133
register_codec(VLenUTF8)
136134
register_codec(VLenBytes)

numcodecs/astype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from .abc import Codec
4-
from .compat import ndarray_copy, ensure_ndarray
4+
from .compat import ensure_ndarray, ndarray_copy
55

66

77
class AsType(Codec):

numcodecs/bitround.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import numpy as np
22

3-
43
from .abc import Codec
54
from .compat import ensure_ndarray_like, ndarray_copy
65

numcodecs/blosc.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def decompress_partial(source, start, nitems, dest=None):
468468
raise RuntimeError('error during blosc partial decompression: %d', ret)
469469

470470
return dest
471-
471+
472472

473473
# set the value of this variable to True or False to override the
474474
# default adaptive behaviour

0 commit comments

Comments
 (0)