mtnlion.domain module

Tools for defining data on multiple domains.

class mtnlion.domain.Domain(*args, **kwargs)[source]

Bases: mtnlion.structures.mountain.Mountain, typing.Mapping

Implementation of Mountain that verifies that the domains fall within VALID_DOMAINS.

domains

Return the domains contained in the object.

Returns

tuple of domains

update([E, ]**F) → None. Update D from dict/iterable E and F.[source]

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

class mtnlion.domain.DomainFunction(func: Callable, domain_names: Union[List[str], Tuple[str]], pass_domain: Optional[bool] = False)[source]

Bases: object

Decorate a given function to run in each of the domains given. The function arguments will be parsed to determine if they are domain aware, and the correct domain will be selected. Otherwise, non domain aware values are passed to the function call exactly the same in every domain.

mtnlion.domain.eval_domain(*domain_names, pass_domain: Optional[bool] = False) → Callable[source]

Easy wrapper to decorate a function to run on given domains.

Parameters
  • domain_names – Domains to run on

  • pass_domain – Add the “domain” argument to the evaluation