An input schema and the named decisions answered together in one
provider call. A stays invariant: decide(definition, input=...)
infers A from both, and a covariant A would widen it to accept any input.
Attributes#
| Attribute | Type | Description |
|---|---|---|
input | S.Codec[A, Any, Any, RE_co] | |
decisions | Mapping[str, AnyDecision] | |
json_input | S.Bottom[A, JsonValue, Any, RE_co] = field(init=False, repr=False) |
|
Functions#
__init__#
__init__(input, decisions) -> None| Parameter | Type | Description |
|---|---|---|
input | S.Codec[A, Any, Any, RE_co] | |
decisions | Mapping[str, AnyDecision] |
name_of#
name_of(decision) -> strThe name decision has here; KeyError when it has none.
| Parameter | Type | Description |
|---|---|---|
decision | AnyDecision |
Returns str
def name_of(self, decision: AnyDecision) -> str:
"""The name ``decision`` has here; ``KeyError`` when it has none."""
for name, candidate in self.decisions.items():
if candidate is decision:
return name
raise KeyError(decision)