diff --git a/src/qcodes/instrument_drivers/Keithley/Keithley_2450.py b/src/qcodes/instrument_drivers/Keithley/Keithley_2450.py index 36b39c1f804..eaadc143053 100644 --- a/src/qcodes/instrument_drivers/Keithley/Keithley_2450.py +++ b/src/qcodes/instrument_drivers/Keithley/Keithley_2450.py @@ -698,6 +698,7 @@ def _set_sense_function(self, value: str) -> None: self.write( f":SENS:FUNC {value}", ) + assert self.sense_function.inverse_val_mapping is not None sense_function = self.sense_function.inverse_val_mapping[value] sense = self.submodules[f"_sense_{sense_function}"] if not isinstance(sense, Keithley2450Sense): @@ -728,8 +729,9 @@ def _set_source_function(self, value: str) -> None: ) self.write(f":SOUR:FUNC {value}") + assert self.source_function.inverse_val_mapping is not None source_function = self.source_function.inverse_val_mapping[value] - source = self.submodules[f"_source_{source_function}"] + source = cast(Keithley2450Source, self.submodules[f"_source_{source_function}"]) self.sense.sweep.setpoints = (source.sweep_axis,) if not isinstance(source, Keithley2450Source): raise RuntimeError( diff --git a/src/qcodes/instrument_drivers/Keithley/Keithley_7510.py b/src/qcodes/instrument_drivers/Keithley/Keithley_7510.py index f31021a03e8..17aef17051e 100644 --- a/src/qcodes/instrument_drivers/Keithley/Keithley_7510.py +++ b/src/qcodes/instrument_drivers/Keithley/Keithley_7510.py @@ -3,6 +3,7 @@ import numpy as np from qcodes.instrument import ( + InstrumentBaseKWArgs, InstrumentChannel, VisaInstrument, VisaInstrumentKWArgs, @@ -455,7 +456,7 @@ def __init__( parent: VisaInstrument, name: str, proper_function: str, - **kwargs: "Unpack[VisaInstrumentKWArgs]", + **kwargs: "Unpack[InstrumentBaseKWArgs]", ) -> None: """ The sense module of the Keithley 7510 DMM, based on the sense module of