1212
1313from zarr .abc .codec import Codec
1414from zarr .abc .metadata import Metadata
15- from zarr .abc .store import set_or_delete
15+ from zarr .abc .store import Store , set_or_delete
1616from zarr .core .array import Array , AsyncArray
1717from zarr .core .attributes import Attributes
1818from zarr .core .buffer import default_buffer_prototype
@@ -122,8 +122,12 @@ class AsyncGroup:
122122 metadata : GroupMetadata
123123 store_path : StorePath
124124
125+ @property
126+ def store (self ) -> Store :
127+ return self .store_path .store
128+
125129 @classmethod
126- async def create (
130+ async def from_store (
127131 cls ,
128132 store : StoreLike ,
129133 * ,
@@ -316,7 +320,7 @@ async def create_group(
316320 attributes : dict [str , Any ] | None = None ,
317321 ) -> AsyncGroup :
318322 attributes = attributes or {}
319- return await type (self ).create (
323+ return await type (self ).from_store (
320324 self .store_path / path ,
321325 attributes = attributes ,
322326 exists_ok = exists_ok ,
@@ -533,8 +537,24 @@ async def move(self, source: str, dest: str) -> None:
533537class Group (SyncMixin ):
534538 _async_group : AsyncGroup
535539
540+ @property
541+ def store (self ) -> Store :
542+ # Backwards compatibility for 2.x
543+ return self ._async_group .store
544+
545+ @property
546+ def read_only (self ) -> bool :
547+ # Backwards compatibility for 2.x
548+ return self ._async_group .store .mode .readonly
549+
550+ @property
551+ def synchronizer (self ) -> None :
552+ # Backwards compatibility for 2.x
553+ # Not implemented in 3.x yet.
554+ return None
555+
536556 @classmethod
537- def create (
557+ def from_store (
538558 cls ,
539559 store : StoreLike ,
540560 * ,
@@ -544,7 +564,7 @@ def create(
544564 ) -> Group :
545565 attributes = attributes or {}
546566 obj = sync (
547- AsyncGroup .create (
567+ AsyncGroup .from_store (
548568 store ,
549569 attributes = attributes ,
550570 exists_ok = exists_ok ,
@@ -665,6 +685,10 @@ def tree(self, expand: bool = False, level: int | None = None) -> Any:
665685 def create_group (self , name : str , ** kwargs : Any ) -> Group :
666686 return Group (self ._sync (self ._async_group .create_group (name , ** kwargs )))
667687
688+ def create (self , * args : Any , ** kwargs : Any ) -> Array :
689+ # Backwards compatibility for 2.x
690+ return self .create_array (* args , ** kwargs )
691+
668692 def create_array (
669693 self ,
670694 name : str ,
0 commit comments