Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4b863f8
Complete Keithley test annotations and replace deprecated snapshot ar…
jenshnielsen Oct 19, 2026
9e38d9d
Add type annotations to shared dataset and delegate fixtures
jenshnielsen Oct 19, 2026
f56757c
Add type annotations to dataset tests
jenshnielsen Oct 19, 2026
acef850
Add type annotations that are meant to fail
jenshnielsen Oct 19, 2026
530fff2
Add type annotations to driver and mocker tests
jenshnielsen Oct 20, 2026
790d750
Add type annotations to extension tests
jenshnielsen Oct 20, 2026
49e3cd6
Add type annotations to parameter tests
jenshnielsen Oct 20, 2026
bbb961a
Add type annotations to core tests and helpers
jenshnielsen Oct 20, 2026
73d649a
Fix load_all_instruments overloads for default args
jenshnielsen Oct 20, 2026
6f0845b
Make interactive widget button tests meaningful
jenshnielsen Oct 20, 2026
cd707a8
Add remaining type annotations to dataset and delegate tests
jenshnielsen Oct 20, 2026
7e4c729
Make in-memory dataset import tests use real data
jenshnielsen Oct 20, 2026
1f1fcbb
Add type annotations to Keysight B1500 tests
jenshnielsen Oct 20, 2026
90cbdac
Add missing type annotations to B1500 MessageBuilder
jenshnielsen Oct 20, 2026
5ec4d16
Accept any AcquisitionInterface in Alazar acquire
jenshnielsen Oct 20, 2026
780831e
Add newsfragments for src typing fixes
jenshnielsen Oct 20, 2026
04e306d
Use PR number in newsfragments
jenshnielsen Oct 21, 2026
46cf260
Defer annotation evaluation in dond tests
jenshnielsen Oct 21, 2026
326d2e0
Require typing_extensions 4.12 or later
jenshnielsen Oct 22, 2026
9c3186a
Enforce types across the code base
jenshnielsen Oct 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/changes/newsfragments/8644.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The type annotations of ``Station.load_all_instruments`` now accept calling it without
arguments or with only one of ``only_names`` and ``only_types``. Previously these valid
calls matched none of the overloads and were rejected by static type checkers.
6 changes: 6 additions & 0 deletions docs/changes/newsfragments/8644.improved_driver
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
``AlazarTechATS.acquire`` is now annotated to accept any ``AcquisitionInterface`` as
``acquisition_controller``, not only an ``AcquisitionController``, matching what it supports
at runtime. ``AcquisitionController`` now passes its type parameter on to
``AcquisitionInterface``, so the return type of ``acquire`` is inferred from the
``post_acquire`` return type of the controller. Subclasses of ``AcquisitionController[T]``
whose ``post_acquire`` does not return ``T`` will now be reported by static type checkers.
3 changes: 3 additions & 0 deletions docs/changes/newsfragments/8644.improved_driver.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Added missing type annotations to the optional arguments of the Keysight B1500
``MessageBuilder`` methods ``ercmaio``, ``lst_query``, ``pch_query``, ``sprm``, ``tc``
and ``wat``.
3 changes: 3 additions & 0 deletions docs/changes/newsfragments/8644.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The minimum supported version of ``typing_extensions`` is now 4.12.0. Older versions do not
apply the default of a ``TypeVar``, so subscripting a parameter with only its value type at
runtime, e.g. ``Parameter[int]``, failed with ``TypeError: Too few arguments`` on Python 3.12.
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies = [
"pyvisa>=1.12.0, <1.17.0",
"ruamel.yaml>=0.16.0,!=0.16.6",
"tabulate>=0.9.0",
"typing_extensions>=4.6.0",
"typing_extensions>=4.12.0",
"tqdm>=4.59.0",
"uncertainties>=3.2.0",
"versioningit>=2.2.1",
Expand Down Expand Up @@ -163,7 +163,6 @@ strict_equality = true
module = [
"tests.*",
"qcodes.instrument_drivers.Harvard.*",
"qcodes.instrument_drivers.Keysight.keysightb1500.message_builder.*",
]
disallow_untyped_defs = false
disallow_incomplete_defs = false
Expand Down Expand Up @@ -202,7 +201,6 @@ reportPrivateUsage = "none"
reportUnknownMemberType = "none"
reportUnknownParameterType = "none"
reportMissingTypeArgument = "none"
reportMissingParameterType = "none"
reportUnknownArgumentType = "none"
reportUnusedFunction = "none"
reportUnusedImport = "none"
Expand Down
4 changes: 2 additions & 2 deletions src/qcodes/instrument_drivers/AlazarTech/ATS.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def acquire[OutputType]( # noqa: D417 (missing args documentation)
get_processed_data: str | None = None,
allocated_buffers: int | None = None,
buffer_timeout: int | None = None,
acquisition_controller: AcquisitionController[OutputType] | None = None,
acquisition_controller: AcquisitionInterface[OutputType] | None = None,
) -> OutputType:
"""
Perform a single acquisition with the Alazar board, and set certain
Expand Down Expand Up @@ -897,7 +897,7 @@ def buffer_done_callback(self, buffers_completed: int) -> None:
"""


class AcquisitionController[OutputType](Instrument, AcquisitionInterface[Any]):
class AcquisitionController[OutputType](Instrument, AcquisitionInterface[OutputType]):
"""
Compatibility class. The methods of :class:`AcquisitionController`
have been extracted. This class is the base class fro AcquisitionInterfaces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,13 @@ def ercmagrd_query(self) -> "MessageBuilder":
self._msg.append(cmd)
return self

def ercmaio(self, cmhl=None, acgs=None, bias=None, corr=None) -> "MessageBuilder":
def ercmaio(
self,
cmhl: int | None = None,
acgs: int | None = None,
bias: int | None = None,
corr: int | None = None,
) -> "MessageBuilder":
cmd = "ERCMAIO"

if cmhl is not None:
Expand Down Expand Up @@ -2191,7 +2197,12 @@ def lssv(
return self

@final_command
def lst_query(self, pnum=None, index=None, size=None) -> "MessageBuilder":
def lst_query(
self,
pnum: int | None = None,
index: int | None = None,
size: int | None = None,
) -> "MessageBuilder":
cmd = "LST?"

if pnum is not None:
Expand Down Expand Up @@ -2593,7 +2604,7 @@ def pch(
return self

@final_command
def pch_query(self, master=None) -> "MessageBuilder":
def pch_query(self, master: constants.ChNr | int | None = None) -> "MessageBuilder":
cmd = "PCH"

if master is not None:
Expand Down Expand Up @@ -3031,7 +3042,9 @@ def spper_query(self) -> "MessageBuilder":
self._msg.append(cmd)
return self

def sprm(self, mode: constants.SPRM.Mode | int, condition=None) -> "MessageBuilder":
def sprm(
self, mode: constants.SPRM.Mode | int, condition: float | None = None
) -> "MessageBuilder":
if condition is None:
cmd = f"SPRM {mode}"
else:
Expand Down Expand Up @@ -3198,7 +3211,7 @@ def tc(
self,
chnum: constants.ChNr | int,
mode: constants.RangingMode | int,
ranging_type=None,
ranging_type: int | None = None,
) -> "MessageBuilder":
cmd = f"TC {chnum},{mode}"

Expand Down Expand Up @@ -3558,7 +3571,10 @@ def wacv(
return self

def wat(
self, wait_time_type: constants.WAT.Type | int, coeff: float, offset=None
self,
wait_time_type: constants.WAT.Type | int,
coeff: float,
offset: float | None = None,
) -> "MessageBuilder":
cmd = f"WAT {wait_time_type},{coeff}"

Expand Down
16 changes: 12 additions & 4 deletions src/qcodes/station.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,22 +847,30 @@ def update_monitor() -> None:
@overload
def load_all_instruments(
self,
only_names: None,
only_types: Iterable[str],
only_names: None = None,
only_types: None = None,
) -> tuple[str, ...]: ...

@overload
def load_all_instruments(
self,
only_names: Iterable[str],
only_types: None,
only_types: None = None,
) -> tuple[str, ...]: ...

@overload
def load_all_instruments(
self,
only_names: None = None,
*,
only_types: Iterable[str],
) -> tuple[str, ...]: ...

@overload
def load_all_instruments(
self,
only_names: None,
only_types: None,
only_types: Iterable[str],
) -> tuple[str, ...]: ...

@overload
Expand Down
2 changes: 1 addition & 1 deletion tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def skip_if_no_fixtures(dbname: str | Path) -> None:
class DummyComponent(MetadatableWithName):
"""Docstring for DummyComponent."""

def __init__(self, name: str):
def __init__(self, name: str) -> None:
super().__init__()
self.name = name

Expand Down
Loading
Loading