Skip to content

Commit 269ad6e

Browse files
committed
Parameter.root_instrument is Instrument
1 parent b8aca1c commit 269ad6e

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
@@ -47,7 +47,7 @@
4747
from types import TracebackType
4848

4949
from qcodes.dataset.data_set_protocol import ValuesType
50-
from qcodes.instrument import InstrumentBase
50+
from qcodes.instrument import Instrument, InstrumentBase
5151
from qcodes.logger.instrument_logger import InstrumentLoggerAdapter
5252
ParameterDataTypeVar = TypeVar("ParameterDataTypeVar", default=Any)
5353
# InstrumentTypeVar_co is a covariant type variable representing the instrument
@@ -1209,15 +1209,15 @@ def instrument(self) -> InstrumentTypeVar_co:
12091209
return self._instrument
12101210

12111211
@property
1212-
def root_instrument(self) -> InstrumentBase | None:
1212+
def root_instrument(self) -> Instrument | None:
12131213
"""
12141214
Return the fundamental instrument that this parameter belongs too.
12151215
E.g if the parameter is bound to a channel this will return the
12161216
fundamental instrument that that channel belongs to. Use
12171217
:meth:`instrument` to get the channel.
12181218
"""
12191219
if self._instrument is not None:
1220-
return self._instrument.root_instrument
1220+
return cast("Instrument | None", self._instrument.root_instrument)
12211221
else:
12221222
return None
12231223

0 commit comments

Comments
 (0)