From 29ef41dc9dd24cd96aaa294b442ea6fb892d5763 Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Tue, 7 Jan 2025 16:04:00 -0800 Subject: [PATCH] Make make_store_path private (#2628) * Clean up public store API * chore: make_store_path is private --------- Co-authored-by: David Stansby --- src/zarr/api/asynchronous.py | 6 ++---- src/zarr/core/array.py | 5 +++-- src/zarr/core/group.py | 4 ++-- src/zarr/storage/__init__.py | 3 +-- tests/test_group.py | 3 ++- tests/test_store/test_core.py | 3 ++- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/zarr/api/asynchronous.py b/src/zarr/api/asynchronous.py index 37a5b76bb..8eba4fc15 100644 --- a/src/zarr/api/asynchronous.py +++ b/src/zarr/api/asynchronous.py @@ -27,16 +27,14 @@ from zarr.core.metadata import ArrayMetadataDict, ArrayV2Metadata, ArrayV3Metadata from zarr.core.metadata.v2 import _default_compressor, _default_filters from zarr.errors import NodeTypeValidationError -from zarr.storage import ( - StoreLike, - make_store_path, -) +from zarr.storage._common import make_store_path if TYPE_CHECKING: from collections.abc import Iterable from zarr.abc.codec import Codec from zarr.core.chunk_key_encodings import ChunkKeyEncoding + from zarr.storage import StoreLike # TODO: this type could use some more thought ArrayLike = AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata] | Array | npt.NDArray[Any] diff --git a/src/zarr/core/array.py b/src/zarr/core/array.py index e0aad8b6a..ea29a6fc4 100644 --- a/src/zarr/core/array.py +++ b/src/zarr/core/array.py @@ -112,8 +112,8 @@ _parse_bytes_bytes_codec, get_pipeline_class, ) -from zarr.storage import StoreLike, make_store_path -from zarr.storage._common import StorePath, ensure_no_existing_node +from zarr.storage import StoreLike +from zarr.storage._common import StorePath, ensure_no_existing_node, make_store_path if TYPE_CHECKING: from collections.abc import Iterator, Sequence @@ -122,6 +122,7 @@ from zarr.abc.codec import CodecPipeline from zarr.codecs.sharding import ShardingCodecIndexLocation from zarr.core.group import AsyncGroup + from zarr.storage import StoreLike # Array and AsyncArray are defined in the base ``zarr`` namespace diff --git a/src/zarr/core/group.py b/src/zarr/core/group.py index 79ab31112..57d9c5cd8 100644 --- a/src/zarr/core/group.py +++ b/src/zarr/core/group.py @@ -50,8 +50,8 @@ from zarr.core.metadata.v3 import V3JsonEncoder from zarr.core.sync import SyncMixin, sync from zarr.errors import MetadataValidationError -from zarr.storage import StoreLike, StorePath, make_store_path -from zarr.storage._common import ensure_no_existing_node +from zarr.storage import StoreLike, StorePath +from zarr.storage._common import ensure_no_existing_node, make_store_path if TYPE_CHECKING: from collections.abc import AsyncGenerator, Generator, Iterable, Iterator diff --git a/src/zarr/storage/__init__.py b/src/zarr/storage/__init__.py index c092ade03..649857f77 100644 --- a/src/zarr/storage/__init__.py +++ b/src/zarr/storage/__init__.py @@ -3,7 +3,7 @@ from types import ModuleType from typing import Any -from zarr.storage._common import StoreLike, StorePath, make_store_path +from zarr.storage._common import StoreLike, StorePath from zarr.storage._fsspec import FsspecStore from zarr.storage._local import LocalStore from zarr.storage._logging import LoggingStore @@ -21,7 +21,6 @@ "StorePath", "WrapperStore", "ZipStore", - "make_store_path", ] diff --git a/tests/test_group.py b/tests/test_group.py index 1d3563fe6..788e81e60 100644 --- a/tests/test_group.py +++ b/tests/test_group.py @@ -22,7 +22,8 @@ from zarr.core.group import ConsolidatedMetadata, GroupMetadata from zarr.core.sync import sync from zarr.errors import ContainsArrayError, ContainsGroupError -from zarr.storage import LocalStore, MemoryStore, StorePath, ZipStore, make_store_path +from zarr.storage import LocalStore, MemoryStore, StorePath, ZipStore +from zarr.storage._common import make_store_path from zarr.testing.store import LatencyStore from .conftest import parse_store diff --git a/tests/test_store/test_core.py b/tests/test_store/test_core.py index 5ab299442..7806f3ece 100644 --- a/tests/test_store/test_core.py +++ b/tests/test_store/test_core.py @@ -5,7 +5,8 @@ from _pytest.compat import LEGACY_PATH from zarr.core.common import AccessModeLiteral -from zarr.storage import FsspecStore, LocalStore, MemoryStore, StoreLike, StorePath, make_store_path +from zarr.storage import FsspecStore, LocalStore, MemoryStore, StoreLike, StorePath +from zarr.storage._common import make_store_path from zarr.storage._utils import normalize_path