22
33from abc import abstractmethod
44from dataclasses import dataclass
5- from typing import Literal , TypeAlias , TypedDict , cast
5+ from typing import TYPE_CHECKING , Literal , TypeAlias , TypedDict , cast
6+
7+ if TYPE_CHECKING :
8+ from typing import NotRequired
69
710from zarr .abc .metadata import Metadata
811from zarr .core .common import (
@@ -22,7 +25,7 @@ def parse_separator(data: JSON) -> SeparatorLiteral:
2225
2326class ChunkKeyEncodingParams (TypedDict ):
2427 name : Literal ["v2" , "default" ]
25- separator : SeparatorLiteral
28+ separator : NotRequired [ SeparatorLiteral ]
2629
2730
2831@dataclass (frozen = True )
@@ -45,7 +48,8 @@ def from_dict(cls, data: dict[str, JSON] | ChunkKeyEncodingLike) -> ChunkKeyEnco
4548 data = {"name" : data ["name" ], "configuration" : {"separator" : data ["separator" ]}}
4649
4750 # configuration is optional for chunk key encodings
48- name_parsed , config_parsed = parse_named_configuration (data , require_configuration = False )
51+ # TODO: remove the type: ignore statement when we use typeddicts for all our static metadata
52+ name_parsed , config_parsed = parse_named_configuration (data , require_configuration = False ) # type: ignore[arg-type]
4953 if name_parsed == "default" :
5054 if config_parsed is None :
5155 # for default, normalize missing configuration to use the "/" separator.
0 commit comments