|
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 |
|
46 | 46 | from types import TracebackType |
47 | 47 |
|
48 | 48 | from qcodes.dataset.data_set_protocol import ValuesType |
49 | | - from qcodes.instrument import InstrumentBase |
| 49 | + from qcodes.instrument import Instrument, InstrumentBase |
50 | 50 | from qcodes.logger.instrument_logger import InstrumentLoggerAdapter |
51 | 51 | ParameterDataTypeVar = TypeVar("ParameterDataTypeVar", default=Any) |
52 | 52 | # InstrumentTypeVar_co is a covariant type variable representing the instrument |
@@ -1080,15 +1080,15 @@ def instrument(self) -> InstrumentTypeVar_co: |
1080 | 1080 | return self._instrument |
1081 | 1081 |
|
1082 | 1082 | @property |
1083 | | - def root_instrument(self) -> InstrumentBase | None: |
| 1083 | + def root_instrument(self) -> Instrument | None: |
1084 | 1084 | """ |
1085 | 1085 | Return the fundamental instrument that this parameter belongs too. |
1086 | 1086 | E.g if the parameter is bound to a channel this will return the |
1087 | 1087 | fundamental instrument that that channel belongs to. Use |
1088 | 1088 | :meth:`instrument` to get the channel. |
1089 | 1089 | """ |
1090 | 1090 | if self._instrument is not None: |
1091 | | - return self._instrument.root_instrument |
| 1091 | + return cast("Instrument | None", self._instrument.root_instrument) |
1092 | 1092 | else: |
1093 | 1093 | return None |
1094 | 1094 |
|
|
0 commit comments