collections#
Domains for common python collections such as lists and dictionaries.
Classes#
Domain of lists of elements of a particular domain. |
|
Domain of dictionaries. |
- class ListDomain#
Bases:
tmlt.core.domains.base.Domain
Domain of lists of elements of a particular domain.
- element_domain: tmlt.core.domains.base.Domain#
Domain of list elements.
- length: int | None = None#
Number of elements in lists in the domain. If None, this is unrestricted.
- validate(value)#
Raises error if value is not a row with matching schema.
- Parameters:
value (Any)
- Return type:
None
- class DictDomain(key_to_domain)#
Bases:
tmlt.core.domains.base.Domain
Domain of dictionaries.
- Parameters:
key_to_domain (Mapping[Any, tmlt.core.domains.base.Domain])
- property key_to_domain: Dict[Any, tmlt.core.domains.base.Domain]#
Returns dictionary mapping each key in the domain with its domain.
- Return type:
Dict[Any, tmlt.core.domains.base.Domain]
- __init__(key_to_domain)#
Constructor.
- __eq__(other)#
Returns True if both domains are identical.
- Parameters:
other (Any)
- Return type:
- __getitem__(key)#
Returns domain associated with given key.
- Parameters:
key (Any)
- Return type:
- validate(value)#
Raises error if value is not in the domain.
- Parameters:
value (Any)
- Return type:
None