Skip to content

Commit 8e50ef8

Browse files
committed
remove re-implementation of get_codec
1 parent c435a59 commit 8e50ef8

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/zarr/codecs/_numcodecs.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import numcodecs.registry as numcodecs_registry
2-
31
from zarr.abc.codec import CodecJSON_V2
42
from zarr.codecs._v2 import Numcodec
53

@@ -22,16 +20,11 @@ def get_numcodec(data: CodecJSON_V2[str]) -> Numcodec:
2220
Examples
2321
--------
2422
25-
>>> codec = get_numcodec({'id': 'zlib', 'level': 1})
23+
>>> codec = get_codec({'id': 'zlib', 'level': 1})
2624
>>> codec
2725
Zlib(level=1)
2826
"""
2927

30-
codec_id = data["id"]
31-
cls = numcodecs_registry.codec_registry.get(codec_id)
32-
if cls is None and data in numcodecs_registry.entries:
33-
cls = numcodecs_registry.entries[data].load()
34-
numcodecs_registry.register_codec(cls, codec_id=data)
35-
if cls is not None:
36-
return cls.from_config({k: v for k, v in data.items() if k != "id"}) # type: ignore[no-any-return]
37-
raise KeyError(data)
28+
from numcodecs.registry import get_codec
29+
30+
return get_codec(data) # type: ignore[no-any-return]

0 commit comments

Comments
 (0)