File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change 1
- import numcodecs .registry as numcodecs_registry
2
-
3
1
from zarr .abc .codec import CodecJSON_V2
4
2
from zarr .codecs ._v2 import Numcodec
5
3
@@ -22,16 +20,11 @@ def get_numcodec(data: CodecJSON_V2[str]) -> Numcodec:
22
20
Examples
23
21
--------
24
22
25
- >>> codec = get_numcodec ({'id': 'zlib', 'level': 1})
23
+ >>> codec = get_codec ({'id': 'zlib', 'level': 1})
26
24
>>> codec
27
25
Zlib(level=1)
28
26
"""
29
27
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]
You can’t perform that action at this time.
0 commit comments