12
12
from zarr .v3 .common import ZARR_JSON , ZARRAY_JSON , ZATTRS_JSON , ZGROUP_JSON , make_cattr
13
13
from zarr .v3 .config import RuntimeConfiguration , SyncConfiguration
14
14
from zarr .v3 .store import StoreLike , StorePath , make_store_path
15
- from zarr .v3 .sync import SyncMixin
15
+ from zarr .v3 .sync import SyncMixin , sync
16
16
17
17
logger = logging .getLogger ("zarr.group" )
18
18
19
19
20
20
@frozen
21
21
class GroupMetadata :
22
22
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 )
25
25
26
26
def to_bytes (self ) -> Dict [str , bytes ]:
27
27
if self .zarr_format == 3 :
@@ -52,7 +52,7 @@ async def create(
52
52
* ,
53
53
attributes : Optional [Dict [str , Any ]] = None ,
54
54
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 ,
56
56
runtime_configuration : RuntimeConfiguration = RuntimeConfiguration (),
57
57
) -> AsyncGroup :
58
58
store_path = make_store_path (store )
@@ -305,13 +305,14 @@ def create(
305
305
exists_ok : bool = False ,
306
306
runtime_configuration : RuntimeConfiguration = RuntimeConfiguration (),
307
307
) -> Group :
308
- obj = cls . _sync (
308
+ obj = sync (
309
309
AsyncGroup .create (
310
310
store ,
311
311
attributes = attributes ,
312
312
exists_ok = exists_ok ,
313
313
runtime_configuration = runtime_configuration ,
314
- )
314
+ ),
315
+ loop = runtime_configuration .asyncio_loop ,
315
316
)
316
317
317
318
return cls (obj )
@@ -322,7 +323,9 @@ def open(
322
323
store : StoreLike ,
323
324
runtime_configuration : RuntimeConfiguration = RuntimeConfiguration (),
324
325
) -> 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
+ )
326
329
return cls (obj )
327
330
328
331
def __getitem__ (self , path : str ) -> Union [Array , Group ]:
0 commit comments