pyiron_workflow.mixin.display_state module
Simple display capabilities to make it easier for humans to see what’s happening.
- class pyiron_workflow.mixin.display_state.HasStateDisplay[source]
Bases:
UsesState,ABCA mixin that leverages
__getstate__()to automatically build a half-decent JSON-compatible representation dictionary.Child classes can over-ride
display_state()to add or remove elements from the display dictionary, e.g. to (optionally) expose state elements that would otherwise be private or to show properties that are computed and not stored in state, or (mandatory – JSON demands it) remove recursion from the state.Provides a
_repr_json_()method leveraging this beautified state dictionary to give a standard JSON representation in Jupyter notebooks.- display_state(state: dict | None = None, ignore_private: bool = True) dict[str, Any][source]
A dictionary of JSON-compatible objects based on the object state (plus whatever modifications to the state the class designer has chosen to make).
Anything that fails to dump to JSON gets cast as a string and then dumped.
- Parameters:
state (dict|None) – The starting state. Default is None which uses __getstate__, but available in case child classes want to first sanitize the state values.
ignore_private (bool) – Whether to ignore or include any state element whose key starts with ‘_’. Default is True, only show public data.
- Return type:
dict