Skip to content

Commit 86095bb

Browse files
committed
fix: allow covariance in ZDType
1 parent 98404bd commit 86095bb

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def to_native_dtype(self) -> DType:
8686
"""
8787

8888
byte_order = endianness_to_numpy_str(self.endianness)
89-
return self.dtype_cls().newbyteorder(byte_order) # type: ignore[return-value]
89+
return self.dtype_cls().newbyteorder(byte_order) # type: ignore[no-any-return,call-overload]
9090

9191
@classmethod
9292
def _check_json_v2(cls, data: DTypeJSON) -> TypeGuard[DTypeConfig_V2[str, None]]:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def to_native_dtype(self) -> DType:
7474
The NumPy data type.
7575
"""
7676
byte_order = endianness_to_numpy_str(self.endianness)
77-
return self.dtype_cls().newbyteorder(byte_order) # type: ignore[return-value]
77+
return self.dtype_cls().newbyteorder(byte_order) # type: ignore[no-any-return,call-overload]
7878

7979
@classmethod
8080
def _check_json_v2(cls, data: DTypeJSON) -> TypeGuard[DTypeConfig_V2[str, None]]:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ class VariableLengthUTF8(UTF8Base[np.dtypes.StringDType]): # type: ignore[type-
740740
The object codec ID for this data type.
741741
"""
742742

743-
dtype_cls = np.dtypes.StringDType
743+
dtype_cls = np.dtypes.StringDType # type: ignore[assignment]
744744

745745
def to_native_dtype(self) -> np.dtypes.StringDType:
746746
"""

src/zarr/core/dtype/wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class variable, and it should generally be unique across different data types.
7070
"""
7171

7272
# this class will create a native data type
73-
dtype_cls: ClassVar[type[DType]]
73+
dtype_cls: ClassVar[type[TBaseDType]]
7474
_zarr_v3_name: ClassVar[str]
7575

7676
@classmethod

0 commit comments

Comments
 (0)