Qcodes icon indicating copy to clipboard operation
Qcodes copied to clipboard

Port usage of add_submodule to assign to an attribute

Open jenshnielsen opened this issue 7 months ago • 0 comments

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__

jenshnielsen avatar May 19 '25 08:05 jenshnielsen