-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Currently we have
TAttr = TypeVar("TAttr", bound=Mapping[str, Any])
TItem = TypeVar("TItem", bound=Union["GroupSpec", "ArraySpec"])
class GroupSpec(NodeSpecV2, Generic[TAttr, TItem]):
attributes: TAttr
members: dict[str, TItem]This excludes the key space of members from the type domain (the keys can be any strings).
What if we did this instead:
TAttr = TypeVar("TAttr", bound=Mapping[str, Any])
TItem = TypeVar("TItem", bound=Dict[str, Union["GroupSpec", "ArraySpec"]])
class GroupSpec(NodeSpecV2, Generic[TAttr, TItem]):
attributes: TAttr
members: TItemI think this would enable requiring that Zarr groups contain nodes with specific names, e.g.
class MyMembers(TypedDict):
s0: ArraySpec[ArrayAttrs]
s1: ArraySpec[ArrayAttrs]
GroupSpec[MyAttributes, MyMembers](...)But it's not clear to how to make this play nice with pydantic models, since they can't be coerced to Dict[str, blablabla]
Metadata
Metadata
Assignees
Labels
No labels