8.5.1.2. pymodaq_utils.plugin_tools.contract module
The contract of an instrument plugin: the methods a plugin class has to (or should) override.
This is the single place where these lists are defined. The static rules (pymodaq_utils.plugin_tools.rules), the
checks (pymodaq_utils.plugin_tools.checks), the plugin tests and the documentation read them from here, so they
cannot disagree.
Added in version 5.3.5.
- class pymodaq_utils.plugin_tools.contract.PluginMethod(name, kind, mandatory, purpose, returns='', legacy_name='')[source]
Bases:
objectOne method of an actuator or detector plugin
- Parameters:
name (
str) – name of the method in the plugin classkind (
Literal['move','viewer']) – actuator (DAQ_Move_base) or detector (DAQ_Viewer_base)mandatory (
bool) – if True, a plugin that does not override it is wrong (error). Otherwise the base class has a default that does nothing or raisesNotImplementedError: override it when the instrument can do it.purpose (
str) – when it is called and what it has to doreturns (
str) – what it has to return (’’ if nothing)legacy_name (
str) – deprecated name that PyMoDAQ still calls if the method is not defined (’’ if none): a plugin defining it fulfils the contract (with a deprecation warning, see rule PMQ312)
- pymodaq_utils.plugin_tools.contract.contract_as_rst()[source]
The contract as two reStructuredText tables, to be included in the documentation
- Return type:
- pymodaq_utils.plugin_tools.contract.legacy_names(kind)[source]
Deprecated names still accepted in place of the mandatory methods: {method name: old name}
- pymodaq_utils.plugin_tools.contract.mandatory_methods(kind)[source]
Names of the methods that a plugin has to override