Placeholder¶
Declare a named placeholder in a graph.
Using a placeholder means that the downstream node(s) are dependent on a value that will be supplied by another node. As such, the downstream graph becomes parametrically dependent on the placeholder (or multiple placeholders). This means the downstream tree does not immediately execute. Instead, the only way to execute it is to wire it into a node that accepts not a value but a graph, such as the Repeat node. A node that accepts graphs can then execute the graph that it receives zero or more times, and can do so each time with a different value for the placeholder (for example the loop counter in the case of a Repeat node). The graph-accepting node defines what placeholders it wants in its received graph; this is called the signature of the graph. The graph that is received by the function in question is in its initial state (nodes are in their initial state), and the graph-accepting node receives a copy of it. When the node evaluates the graph repeatedly, the state evolves, but when the node itself is re-evaluated, it receives again the graph in its initial state. Note that anything that is wired into the parametric graph "from the side" (i.e., coming from nodes whose value is not dependent on a placeholder in the signature) is "captured" and is evaluated at the time the graph is received by the graph-accepting node, and is not re- evaluated each time the node executes the graph (this is usually what one wants). The customary CS terms for these concepts are as follows: a placeholder is a variable, the graph plus signature is a lambda function (or anonymous function), the graph-accepting node is a higher-order function (HOF), and a graph that captures additional values from side inputs is called a closure. More Info... Version 1.0.0
Ports/Properties¶
value¶
Data received.
- verbose name: Value
- default value: None
- port type: DataPort
- value type: object (can be None)
- data direction: OUT
slotname¶
Name of the placeholder slot. This needs to be matched to whatever the node that will fill in the placeholder (e.g., a Repeat) will use.
- verbose name: Name
- default value: unnamed
- port type: StringPort
- value type: str
default¶
Optional default value.
- verbose name: Default
- default value: (unassigned)
- port type: Port
- value type: object (can be None)
value_type¶
Type of the value. This only needs to be specified in function declarations.
- verbose name: Value Type
- default value: object
- port type: ComboPort
- value type: str (can be None)
desc¶
Description for the placeholder. Only needs to be specified in function declarations. This is typically a single sentence.
- verbose name: Description
- default value:
- port type: StringPort
- value type: str (can be None)
verbose_name¶
Optional verbose name for the placeholder. Can be used in function declarations for a more descriptive name.
- verbose name: Verbose Name
- default value: None
- port type: StringPort
- value type: str (can be None)
supports_unassigned¶
Whether this node supports formally unassigned values. If True, the special value Unassigned will be returned when the placeholder is not bound to a value, otherwise an UnevaluableError is raised. This is required for placeholders that are wired into, e.g., CreateList or similar nodes. This must also be set to True for placeholders that reference an option set with WithOptions.
- verbose name: Supports Unassigned
- default value: True
- port type: BoolPort
- value type: bool (can be None)
verbose¶
Under what conditions to generate verbose output. Default is the current NeuroPype default, which may change in the future. Value prints the value itself and disabled prints nothing. Debug prints the value with a "debug" log level, which allows one to selectively filter the logs out by viewing only the "info" log level.
- verbose name: Verbose
- default value: default
- port type: EnumPort
- value type: str (can be None)
set_breakpoint¶
Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.
- verbose name: Set Breakpoint (Debug Only)
- default value: False
- port type: BoolPort
- value type: bool (can be None)
metadata¶
User-definable meta-data associated with the node. Usually reserved for technical purposes.
- verbose name: Metadata
- default value: {}
- port type: DictPort
- value type: dict (can be None)