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(self)#

Returns python list type.

Return type

type

validate(self, value)#

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

Parameters

value (Any) –

__contains__(self, value)#

Returns True if value is in the domain.

Parameters

value (Any) –

Return type

bool

class DictDomain#

Bases: tmlt.core.domains.base.Domain

Domain of dictionaries.

key_to_domain :Dict[Any, tmlt.core.domains.base.Domain]#

Mapping from key to domain.

property length(self)#

Returns number of keys in the domain.

Return type

int

__getitem__(self, key)#

Returns domain associated with given key.

Parameters

key (Any) –

Return type

tmlt.core.domains.base.Domain

property carrier_type(self)#

Returns the type of elements in the domain.

Return type

type

validate(self, value)#

Raises error if value is not in the domain.

Parameters

value (Any) –

__contains__(self, value)#

Returns True if value is in the domain.

Parameters

value (Any) –

Return type

bool