cottax.core.realisation¶
What runs a node, at any level, a driven one included. Takes core and driven/: a driven node’s wrapper joins its level. Generic in the place, and no backend’s.
Dependency:
- driven/ (DrivenNode, the level ImplementedDriven joins)
|| /
- implemented (Implemented, the level; ImplementedFunction /
|| ImplementedDriven, picked by the node’s level in || implemented_as; Implement / Unimplement, / ImplementDrivers)
proof (RealisedGraph over driven.DrivenGraph: every node implemented)
- class Implemented[V: Place][source]¶
Bases:
NodeDefinition[V],Generic[V]A node with what runs it: a callable, or a description of one (location etc.).
- node: AbstractVar[NodeDefinition[V]]¶
a final’s level narrows it.
- Type:
The node run
- implementation: AbstractVar[object]¶
What runs it.
- checks: PerLevel[tuple[Callable[[Any], object], ...]] = (<function check_implemented_once>,)¶
Callable [self] -> iterable of violations, which are raised at construction unless skipped (see unchecked).
- property reads: tuple[V, ...]¶
abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.
- Type:
What the level binds in place of the annotation
- property owns: tuple[V, ...]¶
abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.
- Type:
What the level binds in place of the annotation
- relabel(renaming: Renaming[V])[source]¶
The same definition with its places renamed.
- Return type:
Implemented[V]
- class ImplementedFunction[V: Place](node: FunctionalNode[V], implementation: object)[source]¶
Bases:
Implemented[V],FunctionalNode[V],Generic[V]A function with its body.
- node: FunctionalNode[V]¶
a final’s level narrows it.
- Type:
The node run
- implementation: object¶
What runs it.
- class ImplementedDriven[V: Place](node: DrivenNode[V], implementation: object)[source]¶
Bases:
Implemented[V],DrivenNode[V],Generic[V]A driven node with what runs its driver.
- node: DrivenNode[V]¶
a final’s level narrows it.
- Type:
The node run
- implementation: object¶
What runs it.
- checks: PerLevel[tuple[Callable[[Any], object], ...]] = (<function check_a_contract>,)¶
Callable [self] -> iterable of violations, which are raised at construction unless skipped (see unchecked).
- property unknowns: tuple[V, ...]¶
abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.
- Type:
What the level binds in place of the annotation
- property conditions: tuple[V, ...]¶
abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.
- Type:
What the level binds in place of the annotation
- property condition: ConditionalNode[V]¶
abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.
- Type:
What the level binds in place of the annotation
- property contract: DriverContract[V]¶
abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.
- Type:
What the level binds in place of the annotation
- property data: tuple[tuple[V, ...], ...]¶
abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.
- Type:
What the level binds in place of the annotation
- property reports: tuple[tuple[V, ...], ...]¶
abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.
- Type:
What the level binds in place of the annotation
- implemented_as(node: NodeDefinition)[source]¶
The final implementing node, by its level; None for a level nothing implements. A wrapper joins its level, so a second implementation reaches ImplementedTwice.
- Return type:
type[Implemented] |None
- class Implement[N: Label, V: Place](implementations: OrderedMap[N, object])[source]¶
Bases:
Redefine[N,V],Generic[N,V]Supply what runs some nodes – a function’s body, a driven node’s driver implementation – in one op, since choosing a backend is one decision. Their places are the nodes’ own and are handed straight on.
- implementations: OrderedMap[N, object]¶
- checks: PerLevel[tuple[Callable[[Any], object], ...]] = (<function check_implements_something>,)¶
Callable [self] -> iterable of violations, which are raised at construction unless skipped (see unchecked).
- checks_graph: PerLevel[tuple[Callable, ...]] = (<function check_implementable>,)¶
(op, graph) -> Iterator[Violation], collected by refusals and raised by apply.
- Type:
What the op needs of the graph before it can compute anything
- redefined(graph: NestingGraph[N, V])[source]¶
The new definition for each node this touches. Names not here are untouched.
- Return type:
Mapping[N,NodeDefinition[V]]
- class Unimplement[N: Label, V: Place](nodes: tuple[N, ...])[source]¶
Bases:
Redefine[N,V],Generic[N,V]The inverse of Implement: the implementations dropped, the nodes kept.
- nodes: tuple[N, ...]¶
- checks: PerLevel[tuple[Callable[[Any], object], ...]] = (<function check_unimplements_something>,)¶
Callable [self] -> iterable of violations, which are raised at construction unless skipped (see unchecked).
- checks_graph: PerLevel[tuple[Callable, ...]] = (<function check_unimplements_implemented>,)¶
(op, graph) -> Iterator[Violation], collected by refusals and raised by apply.
- Type:
What the op needs of the graph before it can compute anything
- redefined(graph: NestingGraph[N, V])[source]¶
The new definition for each node this touches. Names not here are untouched.
- Return type:
Mapping[N,NodeDefinition[V]]
- class ImplementDrivers[N: Label, V: Place](implementations: OrderedMap[type[DriverContract], object])[source]¶
Bases:
ComposedOp[N,V],Generic[N,V]What runs every driven node not yet implemented, chosen by its driver’s type: the entry of the most specific contract along its ancestry, whatever order the map is written in. A rule, so on a changed model it chooses again; a node no entry covers is left for the proof to refuse, and a graph with none to implement is refused by Implement.
- implementations: OrderedMap[type[DriverContract], object]¶
- class NotImplementable(node: object, kind: str)[source]¶
Bases:
Violation- node: object¶
- kind: str¶
- template: AbstractClassVar[str] = 'nothing implements a {kind}, which is what {node!r} is -- only a function or a driven node is implemented'¶
e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’
- Type:
Wording
- class RealisedGraph[N: Label, V: Place](graph: NestingGraph[N, V])[source]¶
Bases:
DrivenGraph[N,V],Generic[N,V]A driven graph with what runs every node: what a backend’s proof strengthens.
- checks_node: PerLevel[tuple[Callable[[N, NodeDefinition[V]], Iterator[Violation]], ...]] = (<function check_implemented>,)¶
the one thing a level below adds.
- Type:
(name, node) -> violations
Submodules¶
- cottax.core.realisation.implemented module
check_implemented_once()Implementedcheck_a_function()ImplementedFunctioncheck_a_contract()ImplementedDrivenis_implemented()implemented_as()check_implementable()check_implements_something()Implementcheck_unimplements_implemented()check_unimplements_something()UnimplementImplementDriversImplementedTwiceNotAFunctionNotImplementableNothingImplementedNodeNamedTwiceNotImplementedYetNoContractDeterminedWhileImplementedUndrivenWhileImplemented
- cottax.core.realisation.proof module