|
4 | 4 | import math |
5 | 5 | from dataclasses import dataclass, replace |
6 | 6 | from functools import cached_property |
| 7 | +from typing import Any |
7 | 8 | from warnings import warn |
8 | 9 |
|
9 | 10 | import numpy as np |
|
23 | 24 | from zarr.core.array_spec import ArraySpec |
24 | 25 | from zarr.core.buffer import Buffer, BufferPrototype, NDBuffer |
25 | 26 | from zarr.core.buffer.cpu import as_numpy_array_wrapper |
26 | | -from zarr.core.common import ( |
27 | | - JSON, |
28 | | - parse_named_configuration, |
29 | | - product, |
30 | | -) |
31 | | -from zarr.core.metadata import ArrayMetadata |
| 27 | +from zarr.core.common import JSON, parse_named_configuration, product |
32 | 28 |
|
33 | 29 | CODEC_PREFIX = "numcodecs." |
34 | 30 |
|
@@ -59,7 +55,6 @@ def __init__(self, *, codec_id: str | None = None, codec_config: dict[str, JSON] |
59 | 55 | raise ValueError(f"Codec id does not match {codec_id}. Got: {codec_config['id']}.") |
60 | 56 |
|
61 | 57 | object.__setattr__(self, "codec_config", codec_config) |
62 | | - print("HELLO") |
63 | 58 | warn( |
64 | 59 | "Numcodecs codecs are not in the Zarr version 3 specification and " |
65 | 60 | "may not be supported by other zarr implementations.", |
@@ -269,9 +264,9 @@ def resolve_metadata(self, chunk_spec: ArraySpec) -> ArraySpec: |
269 | 264 | dtype=np.dtype("uint8"), |
270 | 265 | ) |
271 | 266 |
|
272 | | - def validate(self, array_metadata: ArrayMetadata) -> None: |
273 | | - if array_metadata.dtype != np.dtype("bool"): |
274 | | - raise ValueError(f"Packbits filter requires bool dtype. Got {array_metadata.dtype}.") |
| 267 | + def validate(self, *, dtype: np.dtype[Any], **_kwargs) -> None: |
| 268 | + if dtype != np.dtype("bool"): |
| 269 | + raise ValueError(f"Packbits filter requires bool dtype. Got {dtype}.") |
275 | 270 |
|
276 | 271 |
|
277 | 272 | # bytes-to-bytes codecs |
|
0 commit comments