This object represents either an input/output connection or a parameter on a node. Parameter ports can have expressions evaluated with respect to work item, or store a constant value.
Methods ¶
evaluate(work_item=None)
→ int
, float
, str
or list
Untyped evaluation of a parameter port, with respect to a specified work item. The return type is determined based on the pdg.dataType of the port itself.
If the port has multiple components, this method will return a list of int
,
float
or str
values based on the type of the port.
evaluateBool(work_item, index)
→ bool
Evaluates the port as a bolean, with respect to a specific work item and for a particular component index.
evaluateFloat(work_item, index)
→ float
Evaluates the port as a float, with respect to a specific work item and for a particular component index.
evaluateInt(work_item, index)
→ int
Evaluates the port as an integer, with respect to a specific work item and for a particular component index.
evaluateRawString(work_item, index)
→ str
Evaluates the port as a string, with respect to a specific work item and for a particular component index. Does not expand backticks or environment variables.
evaluateString(work_item, index)
→ str
Evaluates the port as a string, with respect to a specific work item and for a particular component index.
hasTag(tag)
→ bool
Returns True
if the port has the specified tag.
connections
: list
of pdg.Port
Property
If the port is an input or output port, the list of connected ports on other nodes.
dataType
: pdg.dataType
Property
The data type of the port, if it is a parameter.
defaultValue
: int
, float
, str
or list
Property
If the port is a parameter, this is the default for the parameter.
expressionAttribs
: list
of str
Property
If the port is a parameeter, returns the list of work item attributes referened by expressions.
hasWorkItemExpression
: bool
Property
Set to True
if the port has an expression that access a work item attribute, such as @pdg_input
or @attrib
. This property is only set when using PDG with TOPs.
isBuiltin
: bool
Property
Set to True
if the port is a built parameter, e.g it begins with the pdg_
prefix and is built into the node type
isCustom
: bool
Property
Set to True
if the port is a custom parameter. Custom parameters are not
on the template pdg.NodeInterface for the node, and are added on a
per-node basis.
name
: str
Property
The name of the port.
portType
: pdg.portType
Property
The type of port, i.e. input, output or parameter.
size
: int
Property
The component count of the port, if it is a parameter.
tags
: list
of str
Property
The tags assigned to the parameter, or empty array if it has no tags.
value
: int
, float
, str
or list
Property
If the port is a parameter, this is the constant value stored on the port.