Skip to content

Commit 269215e

Browse files
committed
remove Any types
1 parent 778d740 commit 269215e

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/zarr/core/_info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
import dataclasses
44
import textwrap
5-
from typing import TYPE_CHECKING, Any, Literal
5+
from typing import TYPE_CHECKING, Literal
66

77
if TYPE_CHECKING:
88
import numcodecs.abc
99

1010
from zarr.abc.codec import ArrayArrayCodec, ArrayBytesCodec, BytesBytesCodec
1111
from zarr.core.common import ZarrFormat
12-
from zarr.core.dtype.wrapper import ZDType
12+
from zarr.core.dtype.wrapper import ZDType, _BaseDType, _BaseScalar
1313

1414

1515
@dataclasses.dataclass(kw_only=True)
@@ -80,7 +80,7 @@ class ArrayInfo:
8080

8181
_type: Literal["Array"] = "Array"
8282
_zarr_format: ZarrFormat
83-
_data_type: ZDType[Any, Any]
83+
_data_type: ZDType[_BaseDType, _BaseScalar]
8484
_shape: tuple[int, ...]
8585
_shard_shape: tuple[int, ...] | None = None
8686
_chunk_shape: tuple[int, ...] | None = None

src/zarr/core/array_spec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from zarr.core.buffer import BufferPrototype
1919
from zarr.core.common import ChunkCoords
20-
from zarr.core.dtype.wrapper import ZDType
20+
from zarr.core.dtype.wrapper import ZDType, _BaseDType, _BaseScalar
2121

2222

2323
class ArrayConfigParams(TypedDict):
@@ -89,15 +89,15 @@ def parse_array_config(data: ArrayConfigLike | None) -> ArrayConfig:
8989
@dataclass(frozen=True)
9090
class ArraySpec:
9191
shape: ChunkCoords
92-
dtype: ZDType[Any, Any]
92+
dtype: ZDType[_BaseDType, _BaseScalar]
9393
fill_value: Any
9494
config: ArrayConfig
9595
prototype: BufferPrototype
9696

9797
def __init__(
9898
self,
9999
shape: ChunkCoords,
100-
dtype: ZDType[Any, Any],
100+
dtype: ZDType[_BaseDType, _BaseScalar],
101101
fill_value: Any,
102102
config: ArrayConfig,
103103
prototype: BufferPrototype,

src/zarr/core/dtype/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, Any, TypeAlias, get_args
3+
from typing import TYPE_CHECKING, TypeAlias, get_args
44

55
if TYPE_CHECKING:
66
from zarr.core.common import ZarrFormat
@@ -77,7 +77,7 @@
7777
| DateTime64
7878
)
7979

80-
ZDTypeLike: TypeAlias = npt.DTypeLike | ZDType[Any, Any] | dict[str, JSON]
80+
ZDTypeLike: TypeAlias = npt.DTypeLike | ZDType[_BaseDType, _BaseScalar] | dict[str, JSON]
8181

8282
for dtype in get_args(DTYPE):
8383
data_type_registry.register(dtype._zarr_v3_name, dtype)
@@ -114,7 +114,7 @@ def get_data_type_from_json(
114114
return data_type_registry.match_json(dtype, zarr_format=zarr_format)
115115

116116

117-
def parse_data_type(dtype: ZDTypeLike, zarr_format: ZarrFormat) -> ZDType[Any, Any]:
117+
def parse_data_type(dtype: ZDTypeLike, zarr_format: ZarrFormat) -> ZDType[_BaseDType, _BaseScalar]:
118118
"""
119119
Interpret the input as a ZDType instance.
120120
"""

src/zarr/core/dtype/_numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ def check_dtype(cls, dtype: _BaseDType) -> TypeGuard[np.dtypes.VoidDType[int]]:
12321232
def _from_dtype_unsafe(cls, dtype: _BaseDType) -> Self:
12331233
from zarr.core.dtype import get_data_type_from_native_dtype
12341234

1235-
fields: list[tuple[str, ZDType[Any, Any]]] = []
1235+
fields: list[tuple[str, ZDType[_BaseDType, _BaseScalar]]] = []
12361236

12371237
if dtype.fields is None:
12381238
raise ValueError("numpy dtype has no fields")

0 commit comments

Comments
 (0)