Case#

class tierkreis.builder.Case(tag: str)[source]#

Bases: CaptureBuilder

Define a graph to handle a specific variant in a Match block.

Methods

add_node_to_graph

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

capture

Capture input from an outer scope, wiring it through the input node.

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

var_value

captured

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 input from an outer scope, wiring it through the input node.

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).