solidipes.loaders.data_container module
- class solidipes.loaders.data_container.DataContainer(initial_data={}, name=None, unique_identifier=None, **kwargs)[source]
Bases:
objectContainer class for other structured data containers.
- class Viewer(data_container=None, add_kwargs={}, show_kwargs={}, **kwargs)
Bases:
ABCAbstract class for viewers.
If istanciated with data, it will directly display it.
- Parameters:
data – data to display
add_kwargs – kwargs to pass to the add method. Note: cannot be passed as a positional argument because of get_data_from_container decorator.
show_kwargs – kwargs to pass to the show method
**kwargs – kwargs to pass to the init method
- _abc_impl = <_abc._abc_data object>
- abstractmethod add(data, **kwargs) None
Add data to the viewer.
- check_data_compatibility(data) bool
Check if data is compatible with the viewer.
- class_path = 'solidipes.viewers.viewer.Viewer'
- compatible_data_types
List of data types (apart from DataContainers) that are compatible with the viewer DataContainers themselves already declare their compatible Viewers
- save(path, **kwargs) NoReturn
Save the view to a file.
- abstractmethod show(**kwargs)
Show the viewer.
- _compatible_viewers: list[Type[Viewer]] = []
List of compatible Viewer classes. Doesn’t need to include Viewer classes already listed in parent classes.
- _data_collection
Dictionary of other DataContainer or arbitrary objects. Set entry to “None” to mark as loadable.
- _has_native_attr(key) bool | None[source]
Check if attribute is present, outside of _data_collection, without using __getattr__.
- class_path = 'solidipes.loaders.data_container.DataContainer'
- compatible_viewers = []
- property data
Load all data if necessary and return it.
Accessing this property for the first time will load the data. If self.__loaded_data has only one entry, returns it directly.
Override the _load_data method in subclasses to define how data is loaded or built using other data containers.
- property data_info
Returns a multi-line string with information about data keys.
- property errors: list[str]
List of validation errors.
- get_is_valid(exclude=[], include=None, validation_results=None) bool[source]
Evaluate if all validators are passing.
- get_validation_results(exclude=[], include=None) list[ValidationResult][source]
Dictionary of validation results.
- property is_valid: bool
Evaluate if all validators are passing.
- load_all
Load all data.
- class loadable(fget, *args, **kwargs)
Bases:
property- wrapped_fget(obj)
- wrapped_fset(obj, value) None
- property preferred_viewer_name: str
Returns the default viewer name for this data container.
- property validation_results: list[ValidationResult]
Dictionary of validation results.
- class solidipes.loaders.data_container.PostInit[source]
Bases:
objectMetaclass to call __post_init__ after all attributes are initialized.
- class solidipes.loaders.data_container.TemporaryFile(delete=False, init=True)[source]
Bases:
object
- solidipes.loaders.data_container._validators: dict[str, list[Validator]] = {}
Lists of validators for each DataContainer class