Skip to content

Commit f03c026

Browse files
committed
undo wrong code changes
1 parent 655d464 commit f03c026

File tree

10 files changed

+19
-21
lines changed

10 files changed

+19
-21
lines changed

src/zarr/api/asynchronous.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from zarr.core.array import Array, AsyncArray, create_array, get_array_metadata
1313
from zarr.core.array_spec import ArrayConfig, ArrayConfigLike
14-
from zarr.core.buffer.core import NDArrayLike
14+
from zarr.core.buffer import NDArrayLike
1515
from zarr.core.common import (
1616
JSON,
1717
AccessModeLiteral,

src/zarr/api/synchronous.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
ShardsLike,
2727
)
2828
from zarr.core.array_spec import ArrayConfig, ArrayConfigLike
29-
from zarr.core.buffer import NDArrayOrScalarLike
30-
from zarr.core.buffer.core import NDArrayLike
29+
from zarr.core.buffer import NDArrayLike, NDArrayOrScalarLike
3130
from zarr.core.chunk_key_encodings import ChunkKeyEncoding, ChunkKeyEncodingLike
3231
from zarr.core.common import (
3332
JSON,

src/zarr/codecs/bytes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import numpy as np
99

1010
from zarr.abc.codec import ArrayBytesCodec
11-
from zarr.core.buffer import Buffer, NDArrayOrScalarLike, NDBuffer
11+
from zarr.core.buffer import Buffer, NDArrayLike, NDBuffer
1212
from zarr.core.common import JSON, parse_enum, parse_named_configuration
1313
from zarr.registry import register_codec
1414

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

8383
as_array_like = chunk_bytes.as_array_like()
84-
if isinstance(as_array_like, NDArrayOrScalarLike):
84+
if isinstance(as_array_like, NDArrayLike):
8585
as_nd_array_like = as_array_like
8686
else:
8787
as_nd_array_like = np.asanyarray(as_array_like)

src/zarr/core/array.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
from zarr.core.attributes import Attributes
3535
from zarr.core.buffer import (
3636
BufferPrototype,
37+
NDArrayLike,
3738
NDArrayOrScalarLike,
3839
NDBuffer,
3940
default_buffer_prototype,
4041
)
41-
from zarr.core.buffer.core import NDArrayLike
4242
from zarr.core.chunk_grids import RegularChunkGrid, _auto_partition, normalize_chunks
4343
from zarr.core.chunk_key_encodings import (
4444
ChunkKeyEncoding,
@@ -1397,7 +1397,7 @@ async def _set_selection(
13971397
# ), f"shape of value doesn't match indexer shape. Expected {indexer.shape}, got {value.shape}"
13981398
if not hasattr(value, "dtype") or value.dtype.name != self.metadata.dtype.name:
13991399
if hasattr(value, "astype"):
1400-
# Handle things that are already NDArrayOrScalarLike more efficiently
1400+
# Handle things that are already NDArrayLike more efficiently
14011401
value = value.astype(dtype=self.metadata.dtype, order="A")
14021402
else:
14031403
value = np.array(value, dtype=self.metadata.dtype, order="A")
@@ -2290,7 +2290,7 @@ def __getitem__(self, selection: Selection) -> NDArrayOrScalarLike:
22902290
Returns
22912291
-------
22922292
NDArrayOrScalarLike
2293-
An array-like containing the data for the requested region.
2293+
An array-like or scalar containing the data for the requested region.
22942294
22952295
Examples
22962296
--------
@@ -2555,7 +2555,7 @@ def get_basic_selection(
25552555
Returns
25562556
-------
25572557
NDArrayOrScalarLike
2558-
An array-like containing the data for the requested region.
2558+
An array-like or scalar containing the data for the requested region.
25592559
25602560
Examples
25612561
--------
@@ -2779,7 +2779,7 @@ def get_orthogonal_selection(
27792779
Returns
27802780
-------
27812781
NDArrayOrScalarLike
2782-
An array-like containing the data for the requested selection.
2782+
An array-like or scalar containing the data for the requested selection.
27832783
27842784
Examples
27852785
--------
@@ -3013,7 +3013,7 @@ def get_mask_selection(
30133013
Returns
30143014
-------
30153015
NDArrayOrScalarLike
3016-
An array-like containing the data for the requested selection.
3016+
An array-like or scalar containing the data for the requested selection.
30173017
30183018
Examples
30193019
--------
@@ -3173,7 +3173,7 @@ def get_coordinate_selection(
31733173
Returns
31743174
-------
31753175
NDArrayOrScalarLike
3176-
An array-like containing the data for the requested coordinate selection.
3176+
An array-like or scalar containing the data for the requested coordinate selection.
31773177
31783178
Examples
31793179
--------
@@ -3361,7 +3361,7 @@ def get_block_selection(
33613361
Returns
33623362
-------
33633363
NDArrayOrScalarLike
3364-
An array-like containing the data for the requested block selection.
3364+
An array-like or scalar containing the data for the requested block selection.
33653365
33663366
Examples
33673367
--------

src/zarr/core/buffer/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
ArrayLike,
33
Buffer,
44
BufferPrototype,
5+
NDArrayLike,
56
NDArrayOrScalarLike,
67
NDBuffer,
78
default_buffer_prototype,
@@ -12,6 +13,7 @@
1213
"ArrayLike",
1314
"Buffer",
1415
"BufferPrototype",
16+
"NDArrayLike",
1517
"NDArrayOrScalarLike",
1618
"NDBuffer",
1719
"default_buffer_prototype",

tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
save_array,
2424
save_group,
2525
)
26-
from zarr.core.buffer.core import NDArrayLike
26+
from zarr.core.buffer import NDArrayLike
2727
from zarr.core.common import JSON, MemoryOrder, ZarrFormat
2828
from zarr.errors import MetadataValidationError
2929
from zarr.storage import MemoryStore

tests/test_array.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
chunks_initialized,
3838
create_array,
3939
)
40-
from zarr.core.buffer import NDArrayOrScalarLike, default_buffer_prototype
41-
from zarr.core.buffer.core import NDArrayLike
40+
from zarr.core.buffer import NDArrayLike, NDArrayOrScalarLike, default_buffer_prototype
4241
from zarr.core.buffer.cpu import NDBuffer
4342
from zarr.core.chunk_grids import _auto_partition
4443
from zarr.core.common import JSON, MemoryOrder, ZarrFormat

tests/test_buffer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
from zarr.codecs.gzip import GzipCodec
1212
from zarr.codecs.transpose import TransposeCodec
1313
from zarr.codecs.zstd import ZstdCodec
14-
from zarr.core.buffer import ArrayLike, BufferPrototype, cpu, gpu
15-
from zarr.core.buffer.core import NDArrayLike
14+
from zarr.core.buffer import ArrayLike, BufferPrototype, NDArrayLike, cpu, gpu
1615
from zarr.storage import MemoryStore, StorePath
1716
from zarr.testing.buffer import (
1817
NDBufferUsingTestNDArrayLike,

tests/test_codecs/test_codecs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
if TYPE_CHECKING:
2525
from zarr.abc.store import Store
26-
from zarr.core.buffer.core import NDArrayLike
26+
from zarr.core.buffer import NDArrayLike
2727
from zarr.core.common import MemoryOrder
2828

2929

tests/test_codecs/test_sharding.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
ShardingCodecIndexLocation,
1717
TransposeCodec,
1818
)
19-
from zarr.core.buffer import default_buffer_prototype
20-
from zarr.core.buffer.core import NDArrayLike
19+
from zarr.core.buffer import NDArrayLike, default_buffer_prototype
2120
from zarr.storage import StorePath
2221

2322
from ..conftest import ArrayRequest

0 commit comments

Comments
 (0)