Skip to content

Commit

Permalink
undo wrong code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
brokkoli71 committed Feb 12, 2025
1 parent 655d464 commit f03c026
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/zarr/api/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from zarr.core.array import Array, AsyncArray, create_array, get_array_metadata
from zarr.core.array_spec import ArrayConfig, ArrayConfigLike
from zarr.core.buffer.core import NDArrayLike
from zarr.core.buffer import NDArrayLike
from zarr.core.common import (
JSON,
AccessModeLiteral,
Expand Down
3 changes: 1 addition & 2 deletions src/zarr/api/synchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
ShardsLike,
)
from zarr.core.array_spec import ArrayConfig, ArrayConfigLike
from zarr.core.buffer import NDArrayOrScalarLike
from zarr.core.buffer.core import NDArrayLike
from zarr.core.buffer import NDArrayLike, NDArrayOrScalarLike
from zarr.core.chunk_key_encodings import ChunkKeyEncoding, ChunkKeyEncodingLike
from zarr.core.common import (
JSON,
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/codecs/bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np

from zarr.abc.codec import ArrayBytesCodec
from zarr.core.buffer import Buffer, NDArrayOrScalarLike, NDBuffer
from zarr.core.buffer import Buffer, NDArrayLike, NDBuffer
from zarr.core.common import JSON, parse_enum, parse_named_configuration
from zarr.registry import register_codec

Expand Down Expand Up @@ -81,7 +81,7 @@ async def _decode_single(
dtype = np.dtype(f"|{chunk_spec.dtype.str[1:]}")

as_array_like = chunk_bytes.as_array_like()
if isinstance(as_array_like, NDArrayOrScalarLike):
if isinstance(as_array_like, NDArrayLike):
as_nd_array_like = as_array_like
else:
as_nd_array_like = np.asanyarray(as_array_like)
Expand Down
16 changes: 8 additions & 8 deletions src/zarr/core/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
from zarr.core.attributes import Attributes
from zarr.core.buffer import (
BufferPrototype,
NDArrayLike,
NDArrayOrScalarLike,
NDBuffer,
default_buffer_prototype,
)
from zarr.core.buffer.core import NDArrayLike
from zarr.core.chunk_grids import RegularChunkGrid, _auto_partition, normalize_chunks
from zarr.core.chunk_key_encodings import (
ChunkKeyEncoding,
Expand Down Expand Up @@ -1397,7 +1397,7 @@ async def _set_selection(
# ), f"shape of value doesn't match indexer shape. Expected {indexer.shape}, got {value.shape}"
if not hasattr(value, "dtype") or value.dtype.name != self.metadata.dtype.name:
if hasattr(value, "astype"):
# Handle things that are already NDArrayOrScalarLike more efficiently
# Handle things that are already NDArrayLike more efficiently
value = value.astype(dtype=self.metadata.dtype, order="A")
else:
value = np.array(value, dtype=self.metadata.dtype, order="A")
Expand Down Expand Up @@ -2290,7 +2290,7 @@ def __getitem__(self, selection: Selection) -> NDArrayOrScalarLike:
Returns
-------
NDArrayOrScalarLike
An array-like containing the data for the requested region.
An array-like or scalar containing the data for the requested region.
Examples
--------
Expand Down Expand Up @@ -2555,7 +2555,7 @@ def get_basic_selection(
Returns
-------
NDArrayOrScalarLike
An array-like containing the data for the requested region.
An array-like or scalar containing the data for the requested region.
Examples
--------
Expand Down Expand Up @@ -2779,7 +2779,7 @@ def get_orthogonal_selection(
Returns
-------
NDArrayOrScalarLike
An array-like containing the data for the requested selection.
An array-like or scalar containing the data for the requested selection.
Examples
--------
Expand Down Expand Up @@ -3013,7 +3013,7 @@ def get_mask_selection(
Returns
-------
NDArrayOrScalarLike
An array-like containing the data for the requested selection.
An array-like or scalar containing the data for the requested selection.
Examples
--------
Expand Down Expand Up @@ -3173,7 +3173,7 @@ def get_coordinate_selection(
Returns
-------
NDArrayOrScalarLike
An array-like containing the data for the requested coordinate selection.
An array-like or scalar containing the data for the requested coordinate selection.
Examples
--------
Expand Down Expand Up @@ -3361,7 +3361,7 @@ def get_block_selection(
Returns
-------
NDArrayOrScalarLike
An array-like containing the data for the requested block selection.
An array-like or scalar containing the data for the requested block selection.
Examples
--------
Expand Down
2 changes: 2 additions & 0 deletions src/zarr/core/buffer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
ArrayLike,
Buffer,
BufferPrototype,
NDArrayLike,
NDArrayOrScalarLike,
NDBuffer,
default_buffer_prototype,
Expand All @@ -12,6 +13,7 @@
"ArrayLike",
"Buffer",
"BufferPrototype",
"NDArrayLike",
"NDArrayOrScalarLike",
"NDBuffer",
"default_buffer_prototype",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
save_array,
save_group,
)
from zarr.core.buffer.core import NDArrayLike
from zarr.core.buffer import NDArrayLike
from zarr.core.common import JSON, MemoryOrder, ZarrFormat
from zarr.errors import MetadataValidationError
from zarr.storage import MemoryStore
Expand Down
3 changes: 1 addition & 2 deletions tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
chunks_initialized,
create_array,
)
from zarr.core.buffer import NDArrayOrScalarLike, default_buffer_prototype
from zarr.core.buffer.core import NDArrayLike
from zarr.core.buffer import NDArrayLike, NDArrayOrScalarLike, default_buffer_prototype
from zarr.core.buffer.cpu import NDBuffer
from zarr.core.chunk_grids import _auto_partition
from zarr.core.common import JSON, MemoryOrder, ZarrFormat
Expand Down
3 changes: 1 addition & 2 deletions tests/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from zarr.codecs.gzip import GzipCodec
from zarr.codecs.transpose import TransposeCodec
from zarr.codecs.zstd import ZstdCodec
from zarr.core.buffer import ArrayLike, BufferPrototype, cpu, gpu
from zarr.core.buffer.core import NDArrayLike
from zarr.core.buffer import ArrayLike, BufferPrototype, NDArrayLike, cpu, gpu
from zarr.storage import MemoryStore, StorePath
from zarr.testing.buffer import (
NDBufferUsingTestNDArrayLike,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_codecs/test_codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

if TYPE_CHECKING:
from zarr.abc.store import Store
from zarr.core.buffer.core import NDArrayLike
from zarr.core.buffer import NDArrayLike
from zarr.core.common import MemoryOrder


Expand Down
3 changes: 1 addition & 2 deletions tests/test_codecs/test_sharding.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
ShardingCodecIndexLocation,
TransposeCodec,
)
from zarr.core.buffer import default_buffer_prototype
from zarr.core.buffer.core import NDArrayLike
from zarr.core.buffer import NDArrayLike, default_buffer_prototype
from zarr.storage import StorePath

from ..conftest import ArrayRequest
Expand Down

0 comments on commit f03c026

Please sign in to comment.