1212from zarr .v3 .common import ZARR_JSON , ZARRAY_JSON , ZATTRS_JSON , ZGROUP_JSON , make_cattr
1313from zarr .v3 .config import RuntimeConfiguration , SyncConfiguration
1414from zarr .v3 .store import StoreLike , StorePath , make_store_path
15- from zarr .v3 .sync import SyncMixin
15+ from zarr .v3 .sync import SyncMixin , sync
1616
1717logger = logging .getLogger ("zarr.group" )
1818
1919
2020@frozen
2121class GroupMetadata :
2222 attributes : Dict [str , Any ] = field (factory = dict )
23- zarr_format : Literal [2 , 3 ] = 3 # field(default=3, validator=validators.in_([2, 3]))
24- node_type : Literal ["group" ] = field (default = "group" , init = False )
23+ zarr_format : Literal [2 , 3 ] = 3
24+ node_type : Literal ["group" ] = field (default = "group" , init = True )
2525
2626 def to_bytes (self ) -> Dict [str , bytes ]:
2727 if self .zarr_format == 3 :
@@ -52,7 +52,7 @@ async def create(
5252 * ,
5353 attributes : Optional [Dict [str , Any ]] = None ,
5454 exists_ok : bool = False ,
55- zarr_format : Literal [2 , 3 ] = 3 , # field(default=3, validator=validators.in_([2, 3])),
55+ zarr_format : Literal [2 , 3 ] = 3 ,
5656 runtime_configuration : RuntimeConfiguration = RuntimeConfiguration (),
5757 ) -> AsyncGroup :
5858 store_path = make_store_path (store )
@@ -305,13 +305,14 @@ def create(
305305 exists_ok : bool = False ,
306306 runtime_configuration : RuntimeConfiguration = RuntimeConfiguration (),
307307 ) -> Group :
308- obj = cls . _sync (
308+ obj = sync (
309309 AsyncGroup .create (
310310 store ,
311311 attributes = attributes ,
312312 exists_ok = exists_ok ,
313313 runtime_configuration = runtime_configuration ,
314- )
314+ ),
315+ loop = runtime_configuration .asyncio_loop ,
315316 )
316317
317318 return cls (obj )
@@ -322,7 +323,9 @@ def open(
322323 store : StoreLike ,
323324 runtime_configuration : RuntimeConfiguration = RuntimeConfiguration (),
324325 ) -> Group :
325- obj = cls ._sync (AsyncGroup .open (store , runtime_configuration ))
326+ obj = sync (
327+ AsyncGroup .open (store , runtime_configuration ), loop = runtime_configuration .asyncio_loop
328+ )
326329 return cls (obj )
327330
328331 def __getitem__ (self , path : str ) -> Union [Array , Group ]:
0 commit comments