Skip to content

Commit 26ced00

Browse files
committed
remove auto_partition
1 parent 3f0a3e0 commit 26ced00

File tree

2 files changed

+1
-39
lines changed

2 files changed

+1
-39
lines changed

src/zarr/core/chunk_grids.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -146,44 +146,6 @@ def normalize_chunks(chunks: Any, shape: tuple[int, ...], typesize: int) -> tupl
146146
return tuple(int(c) for c in chunks)
147147

148148

149-
def _auto_partition(
150-
shape: tuple[int, ...],
151-
dtype: npt.DTypeLike,
152-
shard_shape: tuple[int, ...] | Literal["auto"] | None,
153-
chunk_shape: tuple[int, ...] | Literal["auto"],
154-
) -> tuple[tuple[int, ...] | None, tuple[int, ...]]:
155-
"""
156-
Automatically determine the shard shape and chunk shape for an array, given the shape and dtype of the array.
157-
If `shard_shape` is `None` and the chunk_shape is "auto", the chunks will be set heuristically based
158-
on the dtype and shape of the array.
159-
If `shard_shape` is "auto", then the shard shape will be set heuristically from the dtype and shape
160-
of the array; if the `chunk_shape` is also "auto", then the chunks will be set heuristically as well,
161-
given the dtype and shard shape. Otherwise, the chunks will be returned as-is.
162-
"""
163-
# no sharding
164-
item_size = np.dtype(dtype).itemsize
165-
if shard_shape is None:
166-
_shards_out = None
167-
if chunk_shape == "auto":
168-
_chunks_out = _guess_chunks(shape, item_size)
169-
else:
170-
_chunks_out = chunk_shape
171-
else:
172-
if chunk_shape == "auto":
173-
# aim for a 1MiB chunk
174-
_chunks_out = _guess_chunks(shape, item_size, max_bytes=1024)
175-
else:
176-
_chunks_out = chunk_shape
177-
178-
if shard_shape == "auto":
179-
# TODO: fix me! this should be capped at some sane shard shape
180-
_shards_out = tuple(c * 2 for c in _chunks_out)
181-
else:
182-
_shards_out = shard_shape
183-
184-
return _shards_out, _chunks_out
185-
186-
187149
@dataclass(frozen=True)
188150
class ChunkGrid(Metadata):
189151
@classmethod

src/zarr/core/group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
if TYPE_CHECKING:
4747
from collections.abc import AsyncGenerator, Generator, Iterable, Iterator
4848
from typing import Any
49-
49+
from zarr.core.common import MemoryOrder
5050
from zarr.abc.codec import Codec
5151
from zarr.core.buffer import Buffer, BufferPrototype
5252
from zarr.core.chunk_key_encodings import ChunkKeyEncoding

0 commit comments

Comments
 (0)