pyiron_workflow.mixin.injection module

We want to be able to operate freely on (single-output) nodes and channels as though they were regular objects, but still retain our graph paradigm.

To accomplish this, we overload pyiron_workflow.channel.OutputData to be able to inject new nodes into the graph dynamically.

class pyiron_workflow.mixin.injection.InjectsOnChannel[source]

Bases: HasChannel, ABC

bool()[source]
abstract property channel: OutputDataWithInjection
contains(other)[source]
eq(other)[source]
float()[source]
int()[source]
len()[source]
class pyiron_workflow.mixin.injection.OutputDataWithInjection(label: str, owner: Node, default: Any | None = NOT_DATA, type_hint: Any | None = None, strict_hints: bool = True, value_receiver: OutputData | None = None)[source]

Bases: OutputData

Output data that must have a pyiron_workflow.node.Node for its owner, and which is able to inject new nodes into that owner’s graph, e.g. to accomplish operations on the channel.

This class facilitates many (but not all) python operators by injecting a new node to perform that operation. Where the operator is not supported, we try to support using the operator’s dunder name as a method, e.g. == gives us trouble with hashing, but this exploits the dunder method .__eq__(other), so you can call .eq(other) on output data. These new nodes are instructed to run at the end of instantiation, but this fails cleanly in case they are not ready. This is intended to accommodate two likely scenarios: if you’re injecting a node on top of an existing result you probably want the injection result to also be immediately available, but if you’re injecting it at the end of something that hasn’t run yet you don’t want to see an error.

bool()[source]
contains(other)[source]
eq(other)[source]
float()[source]
int()[source]
len()[source]
class pyiron_workflow.mixin.injection.OutputsWithInjection(*channels: OwnedType)[source]

Bases: GenericOutputs[OutputDataWithInjection]