If#

class tierkreis.builder.If[source]#

Bases: CaptureBuilder

Utility to build an if/else block, adds a Match node when called.

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

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