Add __str__ member

This commit is contained in:
CPD 2025-03-10 11:07:04 +01:00
parent 6b6ec3262f
commit 2232a91f2e
7 changed files with 22 additions and 1 deletions

View File

@ -42,4 +42,8 @@ class LedControlDevice(ABC):
-------
None.
"""
pass
@abstractmethod
def __str__(self):
pass

View File

@ -12,3 +12,6 @@ class TestLedControlDevice(LedControlDevice):
def set_level(self, level: int):
pass
def __str__(self):
return "Dummy Led Controller"

View File

@ -44,4 +44,7 @@ class DC2200(LedControlDevice):
def connect_device(name):
rm = pyvisa.ResourceManager()
instr = rm.open_resource(name)
return DC2200(instr)
return DC2200(instr)
def __str__(self):
return "Thorlabs DC2200"

View File

@ -45,6 +45,9 @@ class LEDD1B(LedControlDevice):
else:
raise ValueError(f"LEDD1B Led controller can only set 0% or 100%")
def __str__(self):
return "Thorlabs LEDD1B"
if __name__ == '__main__':
led = LEDD1B()

View File

@ -50,4 +50,7 @@ class VoltageMeasurementDevice(ABC):
None.
"""
pass
@abstractmethod
def __str__(self):
pass

View File

@ -256,3 +256,5 @@ class Keithley2700(VoltageMeasurementDevice):
instr = rm.open_resource(name)
return Keithley2700(instr)
def __str__(self):
return "Keithley 2700"

View File

@ -52,3 +52,6 @@ class TestVoltageMeasurementDevice(VoltageMeasurementDevice):
"""
pass
def __str__(self):
return "Simulated Voltage Measurement Device"