pyiron_workflow.injection module
This module provides a mixing class for ports and (single-output) nodes to produce _new nodes_ when they are subjected to an operation.
Binary operations are permitted between two such injectable objects, or between an injectable object and a JSONable literal – the literal is wrapped in a Constant source node. This holds for both operand orders (e.g. port - 2 and 2 - port) via the reflected (__r*__) dunders.
Not _all_ operations are injectable. Notably absent are comparators (e.g. ==), which are reserved for use by the actual port/node objects themselves (e.g. to investigate membership in collections), and reflexive operations (e.g. *=), which don’t make sense in a graph paradigm (E.g., wf.some_node.inputs.foo *= wf.inputs.bar?!).
- class pyiron_workflow.injection.InjectionContext(*, port: Callable[[], datatypes.Port], graph: Callable[[], datatypes.Graph | datatypes.Node | None], label: Callable[[], fr.schemas.Label], lexical_path: Callable[[], lexical.LexicalPath])[source]
Bases:
objectTrack
OperatorInjectionMixincontext through mutations by using callable references.- property graph: datatypes.MutableDag | None
- property label: Annotated[str, BeforeValidator(func=_validate_label, json_schema_input_type=PydanticUndefined)]
- property lexical_path: LexicalPath
- property port: datatypes.Port