25
25
from zarr .core .chunk_key_encodings import ChunkKeyEncoding
26
26
from zarr .core .common import JSON
27
27
28
- # CHANGE: Consider adding here
29
28
__all__ = [
30
29
"Registry" ,
31
30
"get_buffer_class" ,
@@ -48,9 +47,9 @@ def __init__(self) -> None:
48
47
super ().__init__ ()
49
48
self .lazy_load_list : list [EntryPoint ] = []
50
49
51
- def lazy_load (self ) -> None :
50
+ def lazy_load (self , use_entrypoint_name : bool = False ) -> None :
52
51
for e in self .lazy_load_list :
53
- self .register (e .load ())
52
+ self .register (e .load (), qualname = e . name if use_entrypoint_name else None )
54
53
55
54
self .lazy_load_list .clear ()
56
55
@@ -158,8 +157,8 @@ def register_buffer(cls: type[Buffer], qualname: str | None = None) -> None:
158
157
__buffer_registry .register (cls , qualname )
159
158
160
159
161
- def register_chunk_key_encoding (cls : type , qualname : str | None = None ) -> None :
162
- __chunk_key_encoding_registry .register (cls , qualname )
160
+ def register_chunk_key_encoding (key : str , cls : type ) -> None :
161
+ __chunk_key_encoding_registry .register (cls , key )
163
162
164
163
165
164
def get_codec_class (key : str , reload_config : bool = False ) -> type [Codec ]:
@@ -300,12 +299,11 @@ def get_ndbuffer_class(reload_config: bool = False) -> type[NDBuffer]:
300
299
301
300
302
301
def get_chunk_key_encoding_class (key : str ) -> type [ChunkKeyEncoding ]:
303
- __chunk_key_encoding_registry .lazy_load ()
302
+ __chunk_key_encoding_registry .lazy_load (use_entrypoint_name = True )
304
303
if key not in __chunk_key_encoding_registry :
305
304
raise KeyError (
306
305
f"Chunk key encoding '{ key } ' not found in registered chunk key encodings: { list (__chunk_key_encoding_registry )} ."
307
306
)
308
-
309
307
return __chunk_key_encoding_registry [key ]
310
308
311
309
0 commit comments