cottax.consumers.declaration.declared module

A tree of models declared: walked in written order, planned with the values and tags written beside it (declare, Declared).

class Declared[N: Label, V: Place](plan: Plan, given: OrderedMap[V, Any], place_tags: Tags[V] = {}, node_tags: Tags[N] = {})[source]

Bases: Frozen, Generic[N, V]

A plan, the values given at its boundary inputs, and the tags written on its places and on its node names. An op edits the plan alone: a value or a tag at a place the plan renames away is left where it was written, and a run takes no value nothing reads.

plan: Plan
given: OrderedMap[V, Any]
place_tags: Tags[V] = {}
node_tags: Tags[N] = {}
property graph: NestingGraph[N, V]
using(values: Mapping[V, Any])[source]

The same, with a value given at each of values, replaced or added: each a boundary input of the graph.

Return type:

Declared[N, V]

declare(*models: Any)[source]

Everything the models declare, each at the node name its position in the tree gives, as a plan, with the values and tags written beside it: declare(d1, d2, {‘opt’: opt}). A declaration held by another keeps only nodes_when_held, a held node nothing.

Return type:

Declared

loose_at[N](model: Declaration | NodeDefinition, names: DerivedNames[N, Any])[source]

The node name a model handed over loose takes, refused where it says none.

Return type:

N

tags_of[T: Tagged](declared: Declared, name: Any, kind: type[T])[source]

The tags of kind written on name, a place or a node name.

Return type:

tuple[T, ...]