Skip to content

Commit fe11bf8

Browse files
committed
Move parsing of init args in CKE to __post_init__.
This enables users to add additional fields to a custom ChunkKeyEncoding without having to override __init__ and taking care of immutability of the attrs.
1 parent 281e87d commit fe11bf8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/zarr/core/chunk_key_encodings.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ class ChunkKeyEncoding(Metadata):
3333
name: str
3434
separator: SeparatorLiteral = "."
3535

36-
def __init__(self, *, separator: SeparatorLiteral) -> None:
37-
separator_parsed = parse_separator(separator)
38-
36+
def __post_init__(self) -> None:
37+
separator_parsed = parse_separator(self.separator)
3938
object.__setattr__(self, "separator", separator_parsed)
4039

4140
@classmethod

0 commit comments

Comments
 (0)