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: int | None = None#

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

property carrier_type: 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])

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]

property length: int#

Returns number of keys in the domain.

Return type:

int

property carrier_type: type#

Returns the type of elements in the domain.

Return type:

type

__init__(key_to_domain)#

Constructor.

Parameters:

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

__eq__(other)#

Returns True if both domains are identical.

Parameters:

other (Any)

Return type:

bool

__getitem__(key)#

Returns domain associated with given key.

Parameters:

key (Any)

Return type:

tmlt.core.domains.base.Domain

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