diff --git a/pyproject.toml b/pyproject.toml index 416bde6b1368..4515823ee8db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ test = [ "hypothesis>=6.130.0", "lxml>=4.9.4", "lxml-stubs>=0.4.0", - "mypy>=1.16.0", + "mypy>=1.20.0", "pandas-stubs>=1.2.0.1", "pytest>=8.2.0", "pytest-asyncio>=0.24.0", diff --git a/requirements.txt b/requirements.txt index 79da4bf2c941..f7a932228975 100644 --- a/requirements.txt +++ b/requirements.txt @@ -194,7 +194,7 @@ matplotlib-inline==0.2.1 # ipython mistune==3.2.0 # via nbconvert -mypy==1.19.1 +mypy==1.20.0 # via qcodes (pyproject.toml) mypy-extensions==1.1.0 # via mypy diff --git a/src/qcodes/extensions/infer.py b/src/qcodes/extensions/infer.py index d22b4060fd6c..a88c98783d07 100644 --- a/src/qcodes/extensions/infer.py +++ b/src/qcodes/extensions/infer.py @@ -1,7 +1,7 @@ from __future__ import annotations from collections.abc import Sequence -from typing import TYPE_CHECKING, ClassVar, TypeVar, cast +from typing import TYPE_CHECKING, ClassVar, TypeVar from qcodes.instrument import Instrument, InstrumentBase, InstrumentModule from qcodes.parameters import DelegateParameter, Parameter, ParameterBase @@ -230,7 +230,7 @@ def get_chain_links_of_type( ) -> tuple[C, ...]: """Gets all parameters in a chain of linked parameters that match a given type""" chain_links: list[C] = [ - cast("C", param) + param for param in get_parameter_chain(parameter) if isinstance(param, link_param_type) ] @@ -265,7 +265,7 @@ def get_parent_instruments_from_chain_of_type( param_chain = get_parameter_chain(parameter) return tuple( [ - cast("TInstrument", param.instrument) + param.instrument for param in param_chain if isinstance(param.instrument, instrument_type) ] diff --git a/src/qcodes/instrument_drivers/AlazarTech/dll_wrapper.py b/src/qcodes/instrument_drivers/AlazarTech/dll_wrapper.py index 15ef43685039..d7573bb5836e 100644 --- a/src/qcodes/instrument_drivers/AlazarTech/dll_wrapper.py +++ b/src/qcodes/instrument_drivers/AlazarTech/dll_wrapper.py @@ -179,10 +179,10 @@ def __apply_signatures(self) -> None: if ret_type is RETURN_CODE: # since RETURN_CODE is a NewType checking that # ret_type is RETURN_CODE only narrows the type - # of it to type. The type checker therefor does not know + # of it to type. The type checker therefore does not know # that this type has a __supertype__ attribute ret_type = ( - ret_type.__supertype__ # pyright: ignore[reportFunctionMemberAccess] + ret_type.__supertype__ # type: ignore[attr-defined] ) c_func.errcheck = _check_error_code elif ret_type in ( diff --git a/src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_module.py b/src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_module.py index 9a219dc378c6..479399c571b2 100644 --- a/src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_module.py +++ b/src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_module.py @@ -378,7 +378,7 @@ def clear_timer_count(self) -> None: class StatusMixin: def __init__(self) -> None: - self.names = tuple(["param1", "param2"]) + self.names: tuple[str, ...] = ("param1", "param2") def status_summary(self) -> dict[str, str]: return_dict: dict[str, str] = {}