@@ -170,10 +170,7 @@ async def consolidate_metadata(
170
170
The group, with the ``consolidated_metadata`` field set to include
171
171
the metadata of each child node.
172
172
"""
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 )
177
174
178
175
group = await AsyncGroup .open (store_path , zarr_format = zarr_format , use_consolidated = False )
179
176
group .store_path .store ._check_writable ()
@@ -291,10 +288,7 @@ async def open(
291
288
"""
292
289
zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
293
290
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 )
298
292
299
293
if "shape" not in kwargs and mode in {"a" , "w" , "w-" }:
300
294
try :
@@ -401,9 +395,7 @@ async def save_array(
401
395
)
402
396
403
397
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 )
407
399
new = await AsyncArray .create (
408
400
store_path ,
409
401
zarr_format = zarr_format ,
@@ -582,9 +574,7 @@ async def group(
582
574
583
575
mode = None if isinstance (store , Store ) else cast (AccessModeLiteral , "a" )
584
576
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 )
588
578
589
579
if chunk_store is not None :
590
580
warnings .warn ("chunk_store is not yet implemented" , RuntimeWarning , stacklevel = 2 )
@@ -697,9 +687,7 @@ async def open_group(
697
687
if chunk_store is not None :
698
688
warnings .warn ("chunk_store is not yet implemented" , RuntimeWarning , stacklevel = 2 )
699
689
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 )
703
691
704
692
if attributes is None :
705
693
attributes = {}
@@ -883,9 +871,7 @@ async def create(
883
871
if not isinstance (store , Store | StorePath ):
884
872
mode = "a"
885
873
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 )
889
875
890
876
return await AsyncArray .create (
891
877
store_path ,
@@ -925,6 +911,7 @@ async def empty(
925
911
retrieve data from an empty Zarr array, any values may be returned,
926
912
and these are not guaranteed to be stable from one access to the next.
927
913
"""
914
+
928
915
return await create (shape = shape , fill_value = None , ** kwargs )
929
916
930
917
@@ -1044,7 +1031,7 @@ async def open_array(
1044
1031
store : StoreLike | None = None ,
1045
1032
zarr_version : ZarrFormat | None = None , # deprecated
1046
1033
zarr_format : ZarrFormat | None = None ,
1047
- path : PathLike | None = None ,
1034
+ path : PathLike = "" ,
1048
1035
storage_options : dict [str , Any ] | None = None ,
1049
1036
** kwargs : Any , # TODO: type kwargs as valid args to save
1050
1037
) -> AsyncArray [ArrayV2Metadata ] | AsyncArray [ArrayV3Metadata ]:
@@ -1071,9 +1058,7 @@ async def open_array(
1071
1058
"""
1072
1059
1073
1060
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 )
1077
1062
1078
1063
zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
1079
1064
0 commit comments