|
8 | 8 | from contextlib import contextmanager |
9 | 9 | from datetime import datetime |
10 | 10 | from functools import cached_property, wraps |
11 | | -from typing import TYPE_CHECKING, Any, ClassVar, Generic, overload |
| 11 | +from typing import TYPE_CHECKING, Any, ClassVar, Generic, cast, overload |
12 | 12 |
|
13 | 13 | import numpy as np |
14 | 14 | from typing_extensions import TypeVar |
|
47 | 47 | from types import TracebackType |
48 | 48 |
|
49 | 49 | from qcodes.dataset.data_set_protocol import ValuesType |
50 | | - from qcodes.instrument import InstrumentBase |
| 50 | + from qcodes.instrument import Instrument, InstrumentBase |
51 | 51 | from qcodes.logger.instrument_logger import InstrumentLoggerAdapter |
52 | 52 | ParameterDataTypeVar = TypeVar("ParameterDataTypeVar", default=Any) |
53 | 53 | # InstrumentTypeVar_co is a covariant type variable representing the instrument |
@@ -1209,15 +1209,15 @@ def instrument(self) -> InstrumentTypeVar_co: |
1209 | 1209 | return self._instrument |
1210 | 1210 |
|
1211 | 1211 | @property |
1212 | | - def root_instrument(self) -> InstrumentBase | None: |
| 1212 | + def root_instrument(self) -> Instrument | None: |
1213 | 1213 | """ |
1214 | 1214 | Return the fundamental instrument that this parameter belongs too. |
1215 | 1215 | E.g if the parameter is bound to a channel this will return the |
1216 | 1216 | fundamental instrument that that channel belongs to. Use |
1217 | 1217 | :meth:`instrument` to get the channel. |
1218 | 1218 | """ |
1219 | 1219 | if self._instrument is not None: |
1220 | | - return self._instrument.root_instrument |
| 1220 | + return cast("Instrument | None", self._instrument.root_instrument) |
1221 | 1221 | else: |
1222 | 1222 | return None |
1223 | 1223 |
|
|
0 commit comments