Skip to content

Commit 7fdecd0

Browse files
committed
Parameter.root_instrument is Instrument
1 parent 1e09c49 commit 7fdecd0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/qcodes/parameters/parameter_base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from contextlib import contextmanager
99
from datetime import datetime
1010
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
1212

1313
import numpy as np
1414
from typing_extensions import TypeVar
@@ -46,7 +46,7 @@
4646
from types import TracebackType
4747

4848
from qcodes.dataset.data_set_protocol import ValuesType
49-
from qcodes.instrument import InstrumentBase
49+
from qcodes.instrument import Instrument, InstrumentBase
5050
from qcodes.logger.instrument_logger import InstrumentLoggerAdapter
5151
ParameterDataTypeVar = TypeVar("ParameterDataTypeVar", default=Any)
5252
# InstrumentTypeVar_co is a covariant type variable representing the instrument
@@ -1080,15 +1080,15 @@ def instrument(self) -> InstrumentTypeVar_co:
10801080
return self._instrument
10811081

10821082
@property
1083-
def root_instrument(self) -> InstrumentBase | None:
1083+
def root_instrument(self) -> Instrument | None:
10841084
"""
10851085
Return the fundamental instrument that this parameter belongs too.
10861086
E.g if the parameter is bound to a channel this will return the
10871087
fundamental instrument that that channel belongs to. Use
10881088
:meth:`instrument` to get the channel.
10891089
"""
10901090
if self._instrument is not None:
1091-
return self._instrument.root_instrument
1091+
return cast("Instrument | None", self._instrument.root_instrument)
10921092
else:
10931093
return None
10941094

0 commit comments

Comments
 (0)