Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified docs/conf.py
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions numcodecs/lzma.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import contextlib

_lzma = None
try:
import lzma as _lzma
except ImportError: # pragma: no cover
try:
with contextlib.suppress(ImportError):
from backports import lzma as _lzma
except ImportError:
pass


if _lzma:
Expand Down
9 changes: 4 additions & 5 deletions numcodecs/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ def get_codec(config):
config = dict(config)
codec_id = config.pop('id', None)
cls = codec_registry.get(codec_id)
if cls is None:
if codec_id in entries:
logger.debug("Auto loading codec '%s' from entrypoint", codec_id)
cls = entries[codec_id].load()
register_codec(cls, codec_id=codec_id)
if cls is None and codec_id in entries:
logger.debug("Auto loading codec '%s' from entrypoint", codec_id)
cls = entries[codec_id].load()
register_codec(cls, codec_id=codec_id)
if cls:
return cls.from_config(config)
raise ValueError(f'codec not available: {codec_id!r}')
Expand Down
4 changes: 2 additions & 2 deletions numcodecs/tests/test_blosc.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_compress_blocksize_default(use_threads):
assert blocksize > 0


@pytest.mark.parametrize('bs', (2**7, 2**8))
@pytest.mark.parametrize('bs', [2**7, 2**8])
def test_compress_blocksize(use_threads, bs):
arr = np.arange(1000, dtype='i4')

Expand Down Expand Up @@ -225,7 +225,7 @@ def _decode_worker(enc):
return data


@pytest.mark.parametrize('pool', (Pool, ThreadPool))
@pytest.mark.parametrize('pool', [Pool, ThreadPool])
def test_multiprocessing(use_threads, pool):
data = np.arange(1000000)
enc = _encode_worker(data)
Expand Down
2 changes: 1 addition & 1 deletion numcodecs/tests/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_backwards_compatibility():


@pytest.mark.parametrize(
"input_data, dtype",
('input_data', 'dtype'),
[
([0, 1], None),
([[0, 1], [2, 3]], None),
Expand Down
2 changes: 1 addition & 1 deletion numcodecs/tests/test_msgpacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_backwards_compatibility():


@pytest.mark.parametrize(
"input_data, dtype",
("input_data", "dtype"),
[
([0, 1], None),
([[0, 1], [2, 3]], None),
Expand Down
2 changes: 1 addition & 1 deletion numcodecs/tests/test_shuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _decode_worker(enc):
return data


@pytest.mark.parametrize('pool', (Pool, ThreadPool))
@pytest.mark.parametrize('pool', [Pool, ThreadPool])
def test_multiprocessing(pool):
data = np.arange(1000000)
enc = _encode_worker(data)
Expand Down
24 changes: 22 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,28 @@ environment = { DISABLE_NUMCODECS_AVX2=1, DISABLE_NUMCODECS_SSE2=1 }
line-length = 100

[tool.ruff.lint]
extend-select = [ "B", "I", "RUF", "UP" ]
ignore = [ "RUF001", "UP007" ]
extend-select = [
"B",
"I",
"PGH",
"PT",
"RSE",
"RUF",
"UP",
]
ignore = [
"B028",
"B904",
"PT001",
"PT004", # deprecated
"PT005", # deprecated
"PT011",
"PT012",
"RUF001",
"UP007",
"UP027", # deprecated
"UP038", # https://github.com/astral-sh/ruff/issues/7871
]

[tool.ruff.format]
quote-style = "preserve"
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,14 @@ def run(self):
build_ext.run(self)
except PlatformError as e:
error(e)
raise BuildFailed() from e
raise BuildFailed from e

def build_extension(self, ext):
try:
build_ext.build_extension(self, ext)
except ext_errors as e:
error(e)
raise BuildFailed() from e
raise BuildFailed from e


class Sclean(clean):
Expand Down
Loading