Skip to content

Port usage of add_submodule to assign to an attribute #7154

@jenshnielsen

Description

@jenshnielsen

Now that add_submodule returns the newly created submodule we should update all instrument drivers in src/qcodes/instrument_drivers to make use of this.

This means that as an example a line like

self.add_submodule("correction", KeysightB1500Correction(self, "correction"))

should be replaced by

self.correction: KeysightB1500Correction = self.add_submodule("correction", KeysightB1500Correction(self, "correction"))
"""
Instrument module correction
"""

e.g the attribute should be assigned to the same value as the name argument, the type should be included and a docstring added after the attribute.

In the first round we should only do this for attributes where the name can be known statically and not try to do this when the name is dynamically created. E.g. We want to avoid using __setattr__

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions