pyiron_workflow.mixin.preview module
Mixin classes for classes which offer previews of input and output at the _class_ level.
The intent is for mixing with pyiron_workflow.node.Node, and for the inputs
and outputs to be IO channels there, but in principle this should function just fine
independently.
These previews need to be available at the class level so that suggestion menus and ontologies can know how mixin classes relate to the rest of the world via input and output without first having to instantiate them.
- class pyiron_workflow.mixin.preview.HasIOPreview[source]
Bases:
ABCAn interface mixin guaranteeing the class-level availability of input and output previews.
E.g. for
pyiron_workflow.node.Nodethat have input and output channels.
- class pyiron_workflow.mixin.preview.ScrapesIO[source]
Bases:
HasIOPreview,ABCA mixin class for scraping IO channel information from a specific class method’s signature and returns.
Requires that the (static and class) method
_io_defining_function()be specified in child classes, as well as_io_defining_function_uses_self(). Optionally,_output_labelscan be overridden at the class level to avoid scraping the return signature for channel labels altogether.Since scraping returns is only possible when the function source code is available, this can be bypassed by manually specifying the class attribute
_output_labels.- _output_labels
The output labels to use. If None, scrapes them from the io-defining function. (Default is None.)
- Type:
tuple[str] | None
- _validate_output_labels
Whether to
- Type:
bool
- _io_defining_function_uses_self
Whether the signature of the IO defining function starts with self. When true, the first argument in the
_io_defining_function()is ignored. (Default is False, use the entire signature for specifying input.)- Type:
bool
Warning
There are a number of class features which, for computational efficiency, get calculated at first call and any subsequent calls return that initial value (including on other instances, since these are class properties); these depend on the
_io_defining_function()and its signature, which should thus be left static from the time of class definition onwards.