cottax.consumers.execution.structures module¶
What a run takes and where a caller keeps it: slots, each boundary input with the key it is given under and its place in a caller’s structure; read_from reads them there, valued_once holds the values found to one per input; write_back writes what a run computed where a structure holds it. Exact places alone: what a name means, and where a datum’s unknown sits in a structure (at), is the caller’s.
- class Inputs[source]¶
Bases:
objectThe key for a variable’s own value, by name or in a structure, beside a driver’s roles: s.run(model, {Inputs: {‘x’: 1.0}}, read_from={Inputs: state}). Not a role.
- class Slot(place: Any, key: type, problem: Any = None, unknown: Any = None, at: Any = None)[source]¶
Bases:
NamedTupleA place a run takes a value at, under key, for unknown of problem, at at in a structure: an input at itself; a per-problem datum for no unknown, at none.
- place: Any¶
Alias for field number 0
- key: type¶
Alias for field number 1
- problem: Any¶
Alias for field number 2
- unknown: Any¶
Alias for field number 3
- at: Any¶
Alias for field number 4
- slots[V: Place](graph: NestingGraph[Any, V], at: Callable[[V], V])[source]¶
Every place a run of graph takes a value at, by what the caller calls it: each driver datum, also one it computes (a warm start), then each boundary input. A place two problems take is there twice.
- Return type:
tuple[Slot,...]
- read_from[V: Place](graph: NestingGraph[Any, V], table: tuple[Slot, ...], structures: Mapping[type, Any])[source]¶
Each value a structure of structures gives an open slot of table, where its key reads it: under Inputs, an input where the structure holds it; under a per-unknown role, the datum at its unknown’s place. What a structure holds beyond is never asked; a slot holding None gives nothing. Refused: a per-problem role, a role no driver takes.
- Return type:
tuple[tuple[Any,Any,str],...]
- valued_once[V: Place](table: tuple[Slot, ...], inputs: tuple[V, ...], candidates: Iterable[tuple[Any, Any, str]])[source]¶
The one value at each input: refused, a place proposed twice (ValuedTwice, naming both sources) and an input none is proposed for (Unvalued, saying how to give it).
- Return type:
OrderedMap[V,Any]
- write_back[V: Place](graph: NestingGraph[Any, V], state: Any, values: Mapping[V, Any])[source]¶
state with each place graph computes written where the state holds it, its value from values (a run’s); an input is never written.
- Return type:
Any
- write_role[V: Place](graph: NestingGraph[Any, V], state: Any, values: Mapping[V, Any], role: type, at: Callable[[V], V])[source]¶
state with the value of each place a driver takes or reports a per-unknown role at, written at at(unknown) where the state holds it: a structure keyed as the unknowns are. Refused: a per-problem role, one no driver has.
- Return type:
Any