flowpipe.plug module

Plugs are ins and outs for Nodes through which they exchange data.

class flowpipe.plug.IPlug(name: str, node: INode)

Bases: object

The interface for the plugs.

Plugs are associated with a Node and can be connected, disconnected and hold a value, that can be accesses by the associated Node.

abstractmethod connect(plug) None

Has to be implemented in the subclass.

disconnect(plug: IPlug) None

Break the connection to the given Plug.

property is_dirty: bool

Access to the dirty status on this Plug.

promote_to_graph(name: str | None = None) None

Add this plug to the graph of this plug’s node.

Parameters:

name (str) – Optionally provide a different name for the Plug

property value: Any

Access to the value on this Plug.

class flowpipe.plug.InputPlug(name: str, node: INode, value: Any = None)

Bases: IPlug

Receives data from an OutputPlug.

connect(plug: OutputPlug) None

Connect this Plug to the given OutputPlug.

Set both participating Plugs dirty.

serialize() dict

Serialize the Plug containing all it’s connections.

class flowpipe.plug.InputPlugGroup(name: str, graph: Graph, plugs: list[InputPlug] | None = None)

Bases: object

Group plugs inside a group into one entry point on the graph.

connect(plug: OutputPlug) None

Connect all plugs in this group to the given plug.

disconnect(plug: OutputPlug) None

Disconnect all plugs in this group from the given plug.

property value: Any

Getting the value of an InputPlugGroup is not supported.

The value property is implemented nonetheless, in order to allow for convenient setting of the value of all plugs in the InputPlugGroup.

class flowpipe.plug.OutputPlug(name: str, node: INode)

Bases: IPlug

Provides data to an InputPlug.

connect(plug: InputPlug | InputPlugGroup) None

Connect this Plug to the given InputPlug.

Set both participating Plugs dirty.

serialize() dict

Serialize the Plug containing all it’s connections.

class flowpipe.plug.SubInputPlug(key: str, node: INode, parent_plug: InputPlug, value: Any = None)

Bases: SubPlug, InputPlug

Held by a parent input plug to form a compound plug.

serialize() dict

Serialize the Plug containing all it’s connections.

class flowpipe.plug.SubOutputPlug(key: str, node: INode, parent_plug: OutputPlug, value: Any = None)

Bases: SubPlug, OutputPlug

Held by a parent output plug to form a compound plug.

serialize() dict

Serialize the Plug containing all it’s connections.

class flowpipe.plug.SubPlug

Bases: object

Mixin that unifies common properties of subplugs.

property is_dirty

Access to the dirty status on this Plug.

promote_to_graph(name: str | None = None) None

Add this plug to the graph of this plug’s node.

NOTE: Subplugs can only be added to a graph via their parent plug.

Parameters:

name (str) – Optionally provide a different name for the Plug