Node Label#

This module defines classes for addressing nodes.

_get_current_flow_name(ctx)[source]#

Get flow name of the current node from context.

Return type:

str

class NodeLabel(**data)[source]#

Bases: BaseModel

A label for a node. (a way to address a specific node in the script)

Can be relative if flow_name is None: such NodeLabel will reference a node with the name node_name in the current flow.

flow_name: Optional[str]#

Name of the flow in the script. Can be None in which case this is inherited from the Context.current_node.

node_name: str#

Name of the node in the flow.

classmethod validate_from_str_or_tuple(data, info)[source]#

Allow instantiating of this class from:

  • A single string (node name). Also attempt to get the current flow name from context.

  • A tuple or list of two strings (flow and node name).

NodeLabelInitTypes#

Types that NodeLabel can be validated from.

alias of Union[NodeLabel, typing.Annotated[str, “node_name, flow name equal to current flow’s name”], Tuple[typing.Annotated[str, ‘flow_name’], typing.Annotated[str, ‘node_name’]], List[str][List[str]], typing.Annotated[dict, ‘dict following the NodeLabel data model’]]

class AbsoluteNodeLabel(**data)[source]#

Bases: NodeLabel

A label for a node. (a way to address a specific node in the script)

flow_name: str#

Name of the flow in the script.

node_name: str#

Name of the node in the flow.

classmethod validate_from_node_label(data, info)[source]#

Allow instantiating of this class from NodeLabel.

Attempt to get the current flow name from context if NodeLabel.flow_name is empty.

check_node_exists(info)[source]#

Validate node exists in the script.

AbsoluteNodeLabelInitTypes#

Types that AbsoluteNodeLabel can be validated from.

alias of Union[AbsoluteNodeLabel, NodeLabel, Tuple[typing.Annotated[str, ‘flow_name’], typing.Annotated[str, ‘node_name’]], List[str][List[str]], typing.Annotated[dict, ‘dict following the AbsoluteNodeLabel data model’]]