Source code for pycif.utils.classes.datavects
from types import MethodType
from ...utils.check.errclass import PluginError
from .baseclass import Plugin
[docs]class DataVect(Plugin):
[docs] def initiate_template(self):
default_functions = ["state2inputs", "outputs2state", "control2native",
"native2control", "sqrtbprod", "sqrtbprod_ad",
"dump", "load"]
super(DataVect, self).initiate_template(
plg_type="datavect",
default_functions={k: True for k in default_functions}
)
[docs] @classmethod
def register_plugin(cls, name, version, module, subtype="", **kwargs):
"""Register a module for a plugin and version with possibly options
Args:
name (str): name of the plugin
version (str): version of the plugin
module (types.ModuleType): module defining the interface
between pyCIF and the plugin
plugin_type (str): type of plugin
**kwargs (dictionary): default options for module
"""
super(DataVect, cls).register_plugin(
name, version, module, plugin_type="datavect", subtype=subtype
)
[docs] def outputs2state(self, *args, **kwargs):
"""Default empty outputs2state method"""
raise PluginError("This is the default empty outputs2state method")
[docs] def control2native(self, *args, **kwargs):
"""Default empty control2native method"""
raise PluginError("This is the default empty control2native method")
[docs] def native2control(self, *args, **kwargs):
"""Default empty native2control method"""
raise PluginError("This is the default empty native2control method")
[docs] def sqrtbprod(self, *args, **kwargs):
"""Default empty sqrtbprod method"""
raise PluginError("This is the default empty sqrtbprod method")
[docs] def sqrtbprod_ad(self, *args, **kwargs):
"""Default empty sqrtbprod_ad method"""
raise PluginError("This is the default empty sqrtbprod_ad method")
[docs] def dump(self, *args, **kwargs):
"""Default empty dump method"""
raise PluginError("This is the default empty dump method")
[docs] def load(self, *args, **kwargs):
"""Default empty load method"""
raise PluginError("This is the default empty load method")