Skip to content

Commit 3f7e2ed

Browse files
committed
make zdtype abstract methods raise notimplementederror
1 parent 2420f9e commit 3f7e2ed

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/zarr/core/dtype/wrapper.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ def from_native_dtype(cls: type[Self], dtype: TBaseDType) -> Self:
102102
"""
103103
Create a ZDType instance from a native data type.
104104
105-
The base implementation first performs a type check via ``cls._check_native_dtype``.
106-
If that type check succeeds, the ZDType class instance is created.
107-
108105
This method is used when taking a user-provided native data type, like a NumPy data type,
109106
and creating the corresponding ZDType instance from them.
110107
@@ -123,7 +120,7 @@ def from_native_dtype(cls: type[Self], dtype: TBaseDType) -> Self:
123120
TypeError
124121
If the native data type is not consistent with the wrapped data type.
125122
"""
126-
...
123+
raise NotImplementedError
127124

128125
@abstractmethod
129126
def to_native_dtype(self: Self) -> TDType_co:
@@ -135,7 +132,7 @@ def to_native_dtype(self: Self) -> TDType_co:
135132
TDType
136133
The native data type wrapped by this ZDType.
137134
"""
138-
...
135+
raise NotImplementedError
139136

140137
@classmethod
141138
@abstractmethod
@@ -190,7 +187,7 @@ def to_json(self, zarr_format: ZarrFormat) -> DTypeSpec_V2 | DTypeSpec_V3:
190187
DTypeJSON_V2 | DTypeJSON_V3
191188
The JSON-serializable representation of the wrapped data type
192189
"""
193-
...
190+
raise NotImplementedError
194191

195192
@abstractmethod
196193
def _check_scalar(self, data: object) -> bool:
@@ -207,7 +204,7 @@ def _check_scalar(self, data: object) -> bool:
207204
Bool
208205
True if the object is valid, False otherwise.
209206
"""
210-
...
207+
raise NotImplementedError
211208

212209
@abstractmethod
213210
def cast_scalar(self, data: object) -> TScalar_co:
@@ -227,6 +224,7 @@ def cast_scalar(self, data: object) -> TScalar_co:
227224
TScalar
228225
The cast value.
229226
"""
227+
raise NotImplementedError
230228

231229
@abstractmethod
232230
def default_scalar(self) -> TScalar_co:
@@ -242,7 +240,7 @@ def default_scalar(self) -> TScalar_co:
242240
TScalar
243241
The default value for this data type.
244242
"""
245-
...
243+
raise NotImplementedError
246244

247245
@abstractmethod
248246
def from_json_scalar(self: Self, data: JSON, *, zarr_format: ZarrFormat) -> TScalar_co:
@@ -262,7 +260,7 @@ def from_json_scalar(self: Self, data: JSON, *, zarr_format: ZarrFormat) -> TSca
262260
TScalar
263261
The deserialized scalar value.
264262
"""
265-
...
263+
raise NotImplementedError
266264

267265
@abstractmethod
268266
def to_json_scalar(self, data: object, *, zarr_format: ZarrFormat) -> JSON:
@@ -285,7 +283,7 @@ def to_json_scalar(self, data: object, *, zarr_format: ZarrFormat) -> JSON:
285283
JSON
286284
The JSON-serialized scalar.
287285
"""
288-
...
286+
raise NotImplementedError
289287

290288

291289
def scalar_failed_type_check_msg(

0 commit comments

Comments
 (0)