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-
31from zarr .abc .codec import CodecJSON_V2
42from 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]
You can’t perform that action at this time.
0 commit comments