@@ -170,10 +170,7 @@ async def consolidate_metadata(
170170 The group, with the ``consolidated_metadata`` field set to include
171171 the metadata of each child node.
172172 """
173- store_path = await make_store_path (store )
174-
175- if path is not None :
176- store_path = store_path / path
173+ store_path = await make_store_path (store , path = path )
177174
178175 group = await AsyncGroup .open (store_path , zarr_format = zarr_format , use_consolidated = False )
179176 group .store_path .store ._check_writable ()
@@ -291,10 +288,7 @@ async def open(
291288 """
292289 zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
293290
294- store_path = await make_store_path (store , mode = mode , storage_options = storage_options )
295-
296- if path is not None :
297- store_path = store_path / path
291+ store_path = await make_store_path (store , mode = mode , path = path , storage_options = storage_options )
298292
299293 if "shape" not in kwargs and mode in {"a" , "w" , "w-" }:
300294 try :
@@ -401,9 +395,7 @@ async def save_array(
401395 )
402396
403397 mode = kwargs .pop ("mode" , None )
404- store_path = await make_store_path (store , mode = mode , storage_options = storage_options )
405- if path is not None :
406- store_path = store_path / path
398+ store_path = await make_store_path (store , path = path , mode = mode , storage_options = storage_options )
407399 new = await AsyncArray .create (
408400 store_path ,
409401 zarr_format = zarr_format ,
@@ -582,9 +574,7 @@ async def group(
582574
583575 mode = None if isinstance (store , Store ) else cast (AccessModeLiteral , "a" )
584576
585- store_path = await make_store_path (store , mode = mode , storage_options = storage_options )
586- if path is not None :
587- store_path = store_path / path
577+ store_path = await make_store_path (store , path = path , mode = mode , storage_options = storage_options )
588578
589579 if chunk_store is not None :
590580 warnings .warn ("chunk_store is not yet implemented" , RuntimeWarning , stacklevel = 2 )
@@ -697,9 +687,7 @@ async def open_group(
697687 if chunk_store is not None :
698688 warnings .warn ("chunk_store is not yet implemented" , RuntimeWarning , stacklevel = 2 )
699689
700- store_path = await make_store_path (store , mode = mode , storage_options = storage_options )
701- if path is not None :
702- store_path = store_path / path
690+ store_path = await make_store_path (store , mode = mode , storage_options = storage_options , path = path )
703691
704692 if attributes is None :
705693 attributes = {}
@@ -883,9 +871,7 @@ async def create(
883871 if not isinstance (store , Store | StorePath ):
884872 mode = "a"
885873
886- store_path = await make_store_path (store , mode = mode , storage_options = storage_options )
887- if path is not None :
888- store_path = store_path / path
874+ store_path = await make_store_path (store , path = path , mode = mode , storage_options = storage_options )
889875
890876 return await AsyncArray .create (
891877 store_path ,
@@ -925,6 +911,7 @@ async def empty(
925911 retrieve data from an empty Zarr array, any values may be returned,
926912 and these are not guaranteed to be stable from one access to the next.
927913 """
914+
928915 return await create (shape = shape , fill_value = None , ** kwargs )
929916
930917
@@ -1044,7 +1031,7 @@ async def open_array(
10441031 store : StoreLike | None = None ,
10451032 zarr_version : ZarrFormat | None = None , # deprecated
10461033 zarr_format : ZarrFormat | None = None ,
1047- path : PathLike | None = None ,
1034+ path : PathLike = "" ,
10481035 storage_options : dict [str , Any ] | None = None ,
10491036 ** kwargs : Any , # TODO: type kwargs as valid args to save
10501037) -> AsyncArray [ArrayV2Metadata ] | AsyncArray [ArrayV3Metadata ]:
@@ -1071,9 +1058,7 @@ async def open_array(
10711058 """
10721059
10731060 mode = kwargs .pop ("mode" , None )
1074- store_path = await make_store_path (store , mode = mode )
1075- if path is not None :
1076- store_path = store_path / path
1061+ store_path = await make_store_path (store , path = path , mode = mode )
10771062
10781063 zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
10791064
0 commit comments