Skip to content

Commit 1f09f76

Browse files
committed
Make name a ClassVar in ChunkKeyEncoding.
This automatically removes it as an init argument.
1 parent 70d99e4 commit 1f09f76

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/zarr/core/chunk_key_encodings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from abc import ABC, abstractmethod
44
from dataclasses import dataclass
5-
from typing import TYPE_CHECKING, Literal, TypeAlias, TypedDict, cast
5+
from typing import TYPE_CHECKING, ClassVar, Literal, TypeAlias, TypedDict, cast
66

77
if TYPE_CHECKING:
88
from typing import NotRequired, Self
@@ -30,7 +30,7 @@ class ChunkKeyEncodingParams(TypedDict):
3030

3131
@dataclass(frozen=True)
3232
class ChunkKeyEncoding(ABC, Metadata):
33-
name: str
33+
name: ClassVar[str]
3434
separator: SeparatorLiteral = "."
3535

3636
def __post_init__(self) -> None:
@@ -65,7 +65,7 @@ def encode_chunk_key(self, chunk_coords: tuple[int, ...]) -> str:
6565

6666
@dataclass(frozen=True)
6767
class DefaultChunkKeyEncoding(ChunkKeyEncoding):
68-
name: Literal["default"] = "default"
68+
name: ClassVar[Literal["default"]] = "default"
6969
separator: SeparatorLiteral = "/" # default
7070

7171
def decode_chunk_key(self, chunk_key: str) -> tuple[int, ...]:
@@ -79,7 +79,7 @@ def encode_chunk_key(self, chunk_coords: tuple[int, ...]) -> str:
7979

8080
@dataclass(frozen=True)
8181
class V2ChunkKeyEncoding(ChunkKeyEncoding):
82-
name: Literal["v2"] = "v2"
82+
name: ClassVar[Literal["v2"]] = "v2"
8383
separator: SeparatorLiteral = "." # default
8484

8585
def decode_chunk_key(self, chunk_key: str) -> tuple[int, ...]:

0 commit comments

Comments
 (0)