finesse.components.node.Port.get_unique_node

Port.get_unique_node(predicate: callable)[source]

Returns the unique node at this port that satisfies the provided predicate. If multiple nodes satisfy this predicate then a RuntimeError is raised.

Parameters:
predicatecallable(components.Node) -> bool

A callable that accepts a Node and returns a boolean value

Examples

Selecting a unique output node:

port.get_unique_node(lambda node: not node.is_input)