PlasmaFactory
- class plasmapy.plasma.plasma_factory.PlasmaFactory(
- default_widget_type=None,
- additional_validation_functions=None,
- registry=None,
Bases:
BasicRegistrationFactoryPlasma factory class. Used to create a variety of Plasma objects. Valid plasma structures are specified by registering them with the factory.
Attention
This feature is under development. Breaking changes may occur in the future.
Methods Summary
__call__(*args, **kwargs)Method for running the factory.
register(WidgetType[, validation_function, ...])Register a widget with the factory.
unregister(WidgetType)Remove a widget from the factory's registry.
Methods Documentation
- __call__(*args, **kwargs)
Method for running the factory.
Arguments args and kwargs are passed through to the validation function and to the constructor for the final type.
- register(WidgetType, validation_function=None, is_default: bool = False)
Register a widget with the factory.
If
validation_functionis not specified, testsWidgetTypefor existence of any function in thevalidation_functionsattribute, which is a list of strings which must be callable class attributes.- Parameters:
WidgetType (
type) – Widget to register.validation_function (function, optional) – Function to validate against. Defaults to
None, which indicates that aclassmethodin thevalidation_functionsattribute is used.is_default (
bool, optional) – SetsWidgetTypeto be the default widget.