secop_ophyd.codegen.module_class#
The generated class of one SECoP module, built from its description.
Module Contents#
Classes#
Builds the attributes of the generated class of one module, and the enum classes and TypedDicts they need. |
Functions#
Description text for generated comments: without trailing whitespace and newlines, keeping intentional internal newlines. |
|
how to create internal names |
|
The parameters and the commands of a module description, by internal name, each with its frappy datatype added under ‘datatype’. |
|
Name of the generated class of a module: its self-reported “implementation” module property (or else the module name), in CamelCase. |
API#
- secop_ophyd.codegen.module_class.normalize_description(description: str | None) str[source]#
Description text for generated comments: without trailing whitespace and newlines, keeping intentional internal newlines.
- secop_ophyd.codegen.module_class.internalize_name(name: str) str[source]#
how to create internal names
- secop_ophyd.codegen.module_class.split_accessibles(moddescr: dict) tuple[dict[str, dict], dict[str, dict]][source]#
The parameters and the commands of a module description, by internal name, each with its frappy datatype added under ‘datatype’.
- secop_ophyd.codegen.module_class.module_class_name(modname: str, properties: dict) str[source]#
Name of the generated class of a module: its self-reported “implementation” module property (or else the module name), in CamelCase.
A controller class declares its channels, which differ between controllers of one implementation: there is one class per controller, with the module name appended.
- class secop_ophyd.codegen.module_class.ModuleClassBuilder[source]#
Builds the attributes of the generated class of one module, and the enum classes and TypedDicts they need.
- device_class: type[secop_ophyd.devices.base.SECoPDevice] = None#
- enums: list[secop_ophyd.codegen.model.EnumClass] = 'field(...)'#
- typed_dicts: list[secop_ophyd.codegen.model.TypedDictClass] = 'field(...)'#
- bases() list[str][source]#
Base classes of the generated class: the device class, parametrized with the type of ‘target’ if it is generic over it (e.g. SECoPMoveableDevice[float] instead of the implicitly Any form).
- properties(properties: dict) list[secop_ophyd.codegen.model.PropertyAttribute][source]#
- channels(controller_channels: dict[str, str], taken: set[str], class_names: dict[str, str]) list[secop_ophyd.codegen.model.ChannelAttribute][source]#
The channel devices of an acquisition controller, named by role.
controller_channelsmaps role -> channel module,takenare the attribute names already in use andclass_namesthe generated class of each module.