collections#

Domains for common python collections such as lists and dictionaries.

Classes#

ListDomain

Domain of lists of elements of a particular domain.

DictDomain

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 :Optional[int]#

Number of elements in lists in the domain. If None, this is unrestricted.

property carrier_type#

Returns python list type.

Return type

type

validate(value)#

Raises error if value is not a row with matching schema.

Parameters

value (Any) –

Return type

None

__contains__(value)#

Returns True if value is in the domain.

Parameters

value (Any) –

Return type

bool

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]) –

__init__(key_to_domain)#

Constructor.

Parameters

key_to_domain (MappingMapping[Any, Domain]) – Mapping from key to domain.

__eq__(other)#

Returns True if both domains are identical.

Parameters

other (Any) –

Return type

bool

property key_to_domain#

Returns dictionary mapping each key in the domain with its domain.

Return type

Dict[Any, tmlt.core.domains.base.Domain]

property length#

Returns number of keys in the domain.

Return type

int

__getitem__(key)#

Returns domain associated with given key.

Parameters

key (Any) –

Return type

tmlt.core.domains.base.Domain

property carrier_type#

Returns the type of elements in the domain.

Return type

type

validate(value)#

Raises error if value is not in the domain.

Parameters

value (Any) –

Return type

None

__contains__(value)#

Returns True if value is in the domain.

Parameters

value (Any) –

Return type

bool