Skip to content

Commit e302ae6

Browse files
committed
format
1 parent ee6d62d commit e302ae6

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/zarr/core/buffer/core.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def __eq__(self, other: object) -> Self: # type: ignore[explicit-override, over
104104
our hands are tied.
105105
"""
106106

107+
107108
class ScalarWrapper:
108109
def __init__(self, value: Any) -> None:
109110
self._value: Any = value
@@ -140,15 +141,19 @@ def __setitem__(self, key: slice, value: Any) -> None:
140141
def __array__(self) -> npt.NDArray[Any]:
141142
return np.array(self._value)
142143

143-
def reshape(self, shape: tuple[int, ...] | Literal[-1], *, order: Literal["A", "C", "F"] = "C") -> Self:
144+
def reshape(
145+
self, shape: tuple[int, ...] | Literal[-1], *, order: Literal["A", "C", "F"] = "C"
146+
) -> Self:
144147
if shape != () and shape != -1:
145148
raise ValueError("Cannot reshape scalar to non-scalar shape")
146149
return self
147150

148151
def view(self, dtype: npt.DTypeLike) -> Self:
149152
return self
150153

151-
def astype(self, dtype: npt.DTypeLike, order: Literal["K", "A", "C", "F"] = "K", *, copy: bool = True) -> Self:
154+
def astype(
155+
self, dtype: npt.DTypeLike, order: Literal["K", "A", "C", "F"] = "K", *, copy: bool = True
156+
) -> Self:
152157
if copy:
153158
return ScalarWrapper(dtype.type(self._value))
154159
self._value = dtype.type(self._value)

src/zarr/core/indexing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
if TYPE_CHECKING:
3131
from zarr.core.array import Array
32-
from zarr.core.buffer import NDArrayLike
3332
from zarr.core.chunk_grids import ChunkGrid
3433
from zarr.core.common import ChunkCoords
3534

tests/test_array.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,4 +1267,3 @@ async def test_scalar_array() -> None:
12671267
assert arr.ndim == 0
12681268
assert arr[()].ndim == 0
12691269
assert isinstance(arr[()], ScalarWrapper)
1270-

0 commit comments

Comments
 (0)