argdigest.Domain#
- class argdigest.Domain(name, contains=None, members=None, depends_on=None, by_value=None, description=None)[source]#
A named, introspectable set of admissible keyword names.
Five MolSysMT functions accept the same 118 attribute names through
**kwargs. A domain lets that be declared once and pointed at, instead of copied per function, and lets the accepted names be read — which is what makes the real signature of an open function documentable rather than only enforceable.contains decides membership. members enumerates it when that is possible, which enables near-miss suggestions and introspection. Either one is enough; giving both keeps membership cheap while still allowing enumeration.
- Parameters:
name (str)
contains (Callable[[str], bool] | None)
members (Callable[[], Iterable[str]] | Iterable[str] | None)
depends_on (str | Sequence[str] | None)
by_value (Mapping[Any, Iterable[str]] | None)
description (str | None)
- __init__(name, contains=None, members=None, depends_on=None, by_value=None, description=None)#
- Parameters:
name (str)
contains (Callable[[str], bool] | None)
members (Callable[[], Iterable[str]] | Iterable[str] | None)
depends_on (str | Sequence[str] | None)
by_value (Mapping[Any, Iterable[str]] | None)
description (str | None)
- Return type:
None
Methods
__init__(name[, contains, members, ...])admits(keyword[, bound])Whether this domain admits keyword, or None when it cannot decide.
known_members()Return the enumerable members, or an empty tuple when not enumerable.
resolve_members([bound])The admissible names for one call, or None when they cannot be decided.
Attributes
by_valuecontainsdepends_ondescriptionis_delegatingmembersname