cottax.pytree.consumers.execution module

Registers a pytree as the DataStructure of a VarPath, each place at its key path.

own(places: Iterable[object])[source]

Refuses a place that is not a VarPath: another class’s with the same keys would be read and written at the VarPath’s.

Return type:

None

class PytreeStructure[source]

Bases: DataStructure[VarPath]

A caller’s pytree, indexed by places: a place is held where its key path resolves. A minted place never does, its root no key of a caller’s.

holds(data: Any, place: VarPath)[source]

Whether data has a slot at place.

Return type:

bool

read(data: Any, places: Iterable[VarPath])[source]

The value in data at each of places, in that order, None where its slot holds none; refuses a place it does not hold.

Return type:

OrderedMap[VarPath, Any]

write(data: Any, values: Mapping[VarPath, Any])[source]

data with values written; refuses a place it cannot hold.

Return type:

Any

completed(graph: Union[NestingGraph[Any, VarPath], ProvedGraph[Any, VarPath]], tree: Any)[source]

tree with None at each place of graph it lacks, a minted one aside, so a run has a slot for every value it writes back. Only a dict grows a key; a None the run must read, an input or a start, is still refused there by name.

Return type:

Any