Match#

class tierkreis.builder.Match(variant_value: NodePort | NodeRef | PortFunc)[source]#

Bases: _CaseScope

Pattern match on a variant value by providing a Case for each variant.

Methods

add_node_to_graph

Add a node to the graph and connect incoming wires, which are specified via keyword arguments.

capture

Capture an input from an outer scope.

input

Get a port from the input node by name.

set_graph_outputs

Set the outputs of the graph by specifying incoming wires as keyword arguments.

type_check

Type check a graph against a provided signature and return a new graph with type annotations.

Attributes

variant_value

nref

graph

inputs

outputs

inner_scopes

debug_info

add_node_to_graph(_tk_node: TierkreisNode, /, **incoming_wires: NodePort | NodeRef | PortFunc) NodeRef#

Add a node to the graph and connect incoming wires, which are specified via keyword arguments.

capture(incoming: NodePort | NodeRef | PortFunc, allow_existing: bool = False) NodePort | NodeRef | PortFunc#

Capture an input from an outer scope.

input(name: str) NodePort#

Get a port from the input node by name.

set_graph_outputs(**incoming_wires: NodePort | NodeRef | PortFunc) None#

Set the outputs of the graph by specifying incoming wires as keyword arguments.

type_check(sig: Signature) TierkreisGraph#

Type check a graph against a provided signature and return a new graph with type annotations. Throws an exception if typecheck optional dependencies not installed).