|
27 | 27 | from zarr.core.metadata import ArrayMetadataDict, ArrayV2Metadata, ArrayV3Metadata |
28 | 28 | from zarr.core.metadata.v2 import _default_filters_and_compressor |
29 | 29 | from zarr.errors import NodeTypeValidationError |
30 | | -from zarr.storage import ( |
31 | | - StoreLike, |
32 | | - make_store_path, |
33 | | -) |
| 30 | +from zarr.storage._common import _make_store_path |
34 | 31 |
|
35 | 32 | if TYPE_CHECKING: |
36 | 33 | from collections.abc import Iterable |
37 | 34 |
|
38 | 35 | from zarr.abc.codec import Codec |
39 | 36 | from zarr.core.chunk_key_encodings import ChunkKeyEncoding |
| 37 | + from zarr.storage import StoreLike |
40 | 38 |
|
41 | 39 | # TODO: this type could use some more thought |
42 | 40 | ArrayLike = AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata] | Array | npt.NDArray[Any] |
@@ -186,7 +184,7 @@ async def consolidate_metadata( |
186 | 184 | The group, with the ``consolidated_metadata`` field set to include |
187 | 185 | the metadata of each child node. |
188 | 186 | """ |
189 | | - store_path = await make_store_path(store, path=path) |
| 187 | + store_path = await _make_store_path(store, path=path) |
190 | 188 |
|
191 | 189 | group = await AsyncGroup.open(store_path, zarr_format=zarr_format, use_consolidated=False) |
192 | 190 | group.store_path.store._check_writable() |
@@ -313,7 +311,9 @@ async def open( |
313 | 311 | """ |
314 | 312 | zarr_format = _handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format) |
315 | 313 |
|
316 | | - store_path = await make_store_path(store, mode=mode, path=path, storage_options=storage_options) |
| 314 | + store_path = await _make_store_path( |
| 315 | + store, mode=mode, path=path, storage_options=storage_options |
| 316 | + ) |
317 | 317 |
|
318 | 318 | # TODO: the mode check below seems wrong! |
319 | 319 | if "shape" not in kwargs and mode in {"a", "r", "r+"}: |
@@ -423,7 +423,9 @@ async def save_array( |
423 | 423 | raise TypeError("arr argument must be numpy or other NDArrayLike array") |
424 | 424 |
|
425 | 425 | mode = kwargs.pop("mode", "a") |
426 | | - store_path = await make_store_path(store, path=path, mode=mode, storage_options=storage_options) |
| 426 | + store_path = await _make_store_path( |
| 427 | + store, path=path, mode=mode, storage_options=storage_options |
| 428 | + ) |
427 | 429 | if np.isscalar(arr): |
428 | 430 | arr = np.array(arr) |
429 | 431 | shape = arr.shape |
@@ -470,7 +472,7 @@ async def save_group( |
470 | 472 | NumPy arrays with data to save. |
471 | 473 | """ |
472 | 474 |
|
473 | | - store_path = await make_store_path(store, path=path, mode="w", storage_options=storage_options) |
| 475 | + store_path = await _make_store_path(store, path=path, mode="w", storage_options=storage_options) |
474 | 476 |
|
475 | 477 | zarr_format = ( |
476 | 478 | _handle_zarr_version_or_format( |
@@ -640,7 +642,9 @@ async def group( |
640 | 642 | mode = "w" |
641 | 643 | else: |
642 | 644 | mode = "r+" |
643 | | - store_path = await make_store_path(store, path=path, mode=mode, storage_options=storage_options) |
| 645 | + store_path = await _make_store_path( |
| 646 | + store, path=path, mode=mode, storage_options=storage_options |
| 647 | + ) |
644 | 648 |
|
645 | 649 | if chunk_store is not None: |
646 | 650 | warnings.warn("chunk_store is not yet implemented", RuntimeWarning, stacklevel=2) |
@@ -754,7 +758,9 @@ async def open_group( |
754 | 758 | if chunk_store is not None: |
755 | 759 | warnings.warn("chunk_store is not yet implemented", RuntimeWarning, stacklevel=2) |
756 | 760 |
|
757 | | - store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path) |
| 761 | + store_path = await _make_store_path( |
| 762 | + store, mode=mode, storage_options=storage_options, path=path |
| 763 | + ) |
758 | 764 |
|
759 | 765 | if attributes is None: |
760 | 766 | attributes = {} |
@@ -969,7 +975,9 @@ async def create( |
969 | 975 | mode = kwargs.pop("mode", None) |
970 | 976 | if mode is None: |
971 | 977 | mode = "a" |
972 | | - store_path = await make_store_path(store, path=path, mode=mode, storage_options=storage_options) |
| 978 | + store_path = await _make_store_path( |
| 979 | + store, path=path, mode=mode, storage_options=storage_options |
| 980 | + ) |
973 | 981 |
|
974 | 982 | config_dict: ArrayConfigParams = {} |
975 | 983 |
|
@@ -1182,7 +1190,9 @@ async def open_array( |
1182 | 1190 | """ |
1183 | 1191 |
|
1184 | 1192 | mode = kwargs.pop("mode", None) |
1185 | | - store_path = await make_store_path(store, path=path, mode=mode, storage_options=storage_options) |
| 1193 | + store_path = await _make_store_path( |
| 1194 | + store, path=path, mode=mode, storage_options=storage_options |
| 1195 | + ) |
1186 | 1196 |
|
1187 | 1197 | zarr_format = _handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format) |
1188 | 1198 |
|
|
0 commit comments