Skip to content

Commit c8061bf

Browse files
committed
fix mysterious linting errors
1 parent 1f0322f commit c8061bf

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/zarr/core/_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def byte_info(size: int) -> str:
6969

7070

7171
@dataclasses.dataclass(kw_only=True, frozen=True, slots=True)
72-
class ArrayInfo:
72+
class ArrayInfo: # type: ignore[misc]
7373
"""
7474
Visual summary for an Array.
7575

src/zarr/core/dtype/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def check_dtype_spec_v2(data: object) -> TypeGuard[DTypeSpec_V2]:
125125
DTypeSpec_V3 = str | NamedConfig[str, Mapping[str, object]]
126126

127127

128-
def check_dtype_spec_v3(data: object) -> TypeGuard[DTypeSpec_V3]:
128+
def check_dtype_spec_v3(data: object) -> TypeGuard[DTypeSpec_V3]: # type: ignore[valid-type]
129129
"""
130130
Type guard for narrowing the type of a python object to an instance of
131131
DTypeSpec_V3, i.e either a string or a dict with a "name" field that's a string and a
@@ -141,7 +141,7 @@ def check_dtype_spec_v3(data: object) -> TypeGuard[DTypeSpec_V3]:
141141
return False
142142

143143

144-
def unpack_dtype_json(data: DTypeSpec_V2 | DTypeSpec_V3) -> DTypeJSON:
144+
def unpack_dtype_json(data: DTypeSpec_V2 | DTypeSpec_V3) -> DTypeJSON: # type: ignore[valid-type]
145145
"""
146146
Return the array metadata form of the dtype JSON representation. For the Zarr V3 form of dtype
147147
metadata, this is a no-op. For the Zarr V2 form of dtype metadata, this unpacks the dtype name.

src/zarr/core/dtype/npy/structured.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def to_json(self, zarr_format: ZarrFormat) -> StructuredJSON_V2 | StructuredJSON
317317
elif zarr_format == 3:
318318
v3_unstable_dtype_warning(self)
319319
fields = [
320-
[f_name, f_dtype.to_json(zarr_format=zarr_format)] # type: ignore[list-item]
320+
[f_name, f_dtype.to_json(zarr_format=zarr_format)]
321321
for f_name, f_dtype in self.fields
322322
]
323323
base_dict = {

src/zarr/core/dtype/wrapper.py

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

5858

5959
@dataclass(frozen=True, kw_only=True, slots=True)
60-
class ZDType(ABC, Generic[TDType_co, TScalar_co]):
60+
class ZDType(ABC, Generic[TDType_co, TScalar_co]): # type: ignore[misc]
6161
"""
6262
Abstract base class for wrapping native array data types, e.g. numpy dtypes
6363
@@ -169,10 +169,10 @@ def from_json(cls: type[Self], data: DTypeJSON, *, zarr_format: ZarrFormat) -> S
169169
def to_json(self, zarr_format: Literal[2]) -> DTypeSpec_V2: ...
170170

171171
@overload
172-
def to_json(self, zarr_format: Literal[3]) -> DTypeSpec_V3: ...
172+
def to_json(self, zarr_format: Literal[3]) -> DTypeSpec_V3: ... # type: ignore[valid-type]
173173

174174
@abstractmethod
175-
def to_json(self, zarr_format: ZarrFormat) -> DTypeSpec_V2 | DTypeSpec_V3:
175+
def to_json(self, zarr_format: ZarrFormat) -> DTypeSpec_V2 | DTypeSpec_V3: # type: ignore[valid-type]
176176
"""
177177
Serialize this ZDType to JSON.
178178

tests/test_dtype/test_wrapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class BaseTestZDType:
8080
valid_json_v2: ClassVar[tuple[DTypeSpec_V2, ...]] = ()
8181
invalid_json_v2: ClassVar[tuple[str | dict[str, object] | list[object], ...]] = ()
8282

83-
valid_json_v3: ClassVar[tuple[DTypeSpec_V3, ...]] = ()
83+
valid_json_v3: ClassVar[tuple[DTypeSpec_V3, ...]] = () # type: ignore[valid-type]
8484
invalid_json_v3: ClassVar[tuple[str | dict[str, object], ...]] = ()
8585

8686
# for testing scalar round-trip serialization, we need a tuple of (data type json, scalar json)
@@ -120,9 +120,9 @@ def test_from_json_roundtrip_v2(self, valid_json_v2: DTypeSpec_V2) -> None:
120120
assert zdtype.to_json(zarr_format=2) == valid_json_v2
121121

122122
@pytest.mark.filterwarnings("ignore::zarr.core.dtype.common.UnstableSpecificationWarning")
123-
def test_from_json_roundtrip_v3(self, valid_json_v3: DTypeSpec_V3) -> None:
123+
def test_from_json_roundtrip_v3(self, valid_json_v3: DTypeSpec_V3) -> None: # type: ignore[valid-type]
124124
zdtype = self.test_cls.from_json(valid_json_v3, zarr_format=3)
125-
assert zdtype.to_json(zarr_format=3) == valid_json_v3
125+
assert zdtype.to_json(zarr_format=3) == valid_json_v3 # type: ignore[operator]
126126

127127
def test_scalar_roundtrip_v2(self, scalar_v2_params: tuple[ZDType[Any, Any], Any]) -> None:
128128
zdtype, scalar_json = scalar_v2_params

0 commit comments

Comments
 (0)