Skip to content

Commit 22b686f

Browse files
committed
remove inheritance from ArrayMetadata
1 parent 66009e3 commit 22b686f

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/zarr/core/metadata/common.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
if TYPE_CHECKING:
66
from typing import Any, Literal, Self
77

8-
import numpy as np
9-
108
from zarr.core.array_spec import ArraySpec
119
from zarr.core.buffer import Buffer, BufferPrototype
1210
from zarr.core.chunk_grids import ChunkGrid

src/zarr/core/metadata/v2.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from enum import Enum
55
from typing import TYPE_CHECKING
66

7+
from zarr.abc.metadata import Metadata
8+
79
if TYPE_CHECKING:
810
from typing import Any, Literal, Self
911

@@ -23,11 +25,11 @@
2325
from zarr.core.chunk_key_encodings import parse_separator
2426
from zarr.core.common import ZARRAY_JSON, ZATTRS_JSON, parse_shapelike
2527
from zarr.core.config import config, parse_indexing_order
26-
from zarr.core.metadata.common import ArrayMetadata, parse_attributes
28+
from zarr.core.metadata.common import parse_attributes
2729

2830

2931
@dataclass(frozen=True, kw_only=True)
30-
class ArrayV2Metadata(ArrayMetadata):
32+
class ArrayV2Metadata(Metadata):
3133
shape: ChunkCoords
3234
chunks: RegularChunkGrid
3335
dtype: np.dtype[Any]
@@ -144,7 +146,7 @@ def from_dict(cls, data: dict[str, Any]) -> ArrayV2Metadata:
144146

145147
def to_dict(self) -> dict[str, JSON]:
146148
zarray_dict = super().to_dict()
147-
_ = zarray_dict.pop("chunk_grid")
149+
_ = zarray_dict.pop("chunks")
148150
zarray_dict["chunks"] = self.chunks.chunk_shape
149151

150152
_ = zarray_dict.pop("dtype")

src/zarr/core/metadata/v3.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import warnings
44
from typing import TYPE_CHECKING, cast, overload
55

6+
from zarr.abc.metadata import Metadata
7+
68
if TYPE_CHECKING:
79
from typing import Self
810

@@ -28,7 +30,7 @@
2830
from zarr.core.chunk_key_encodings import ChunkKeyEncoding
2931
from zarr.core.common import ZARR_JSON, parse_named_configuration, parse_shapelike
3032
from zarr.core.config import config
31-
from zarr.core.metadata.common import ArrayMetadata, parse_attributes
33+
from zarr.core.metadata.common import parse_attributes
3234
from zarr.registry import get_codec_class
3335

3436

@@ -150,7 +152,7 @@ def _replace_special_floats(obj: object) -> Any:
150152

151153

152154
@dataclass(frozen=True, kw_only=True)
153-
class ArrayV3Metadata(ArrayMetadata):
155+
class ArrayV3Metadata(Metadata):
154156
shape: ChunkCoords
155157
data_type: np.dtype[Any]
156158
chunk_grid: ChunkGrid

0 commit comments

Comments
 (0)