From e6e7db7e7bad0bf6662e81d0110a694128146ea0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Jul 2026 04:43:36 +0000 Subject: [PATCH 1/2] Bump https://github.com/astral-sh/ruff-pre-commit Bumps [https://github.com/astral-sh/ruff-pre-commit](https://github.com/astral-sh/ruff-pre-commit) from v0.15.22 to 0.16.0. - [Release notes](https://github.com/astral-sh/ruff-pre-commit/releases) - [Commits](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.22...v0.16.0) --- updated-dependencies: - dependency-name: https://github.com/astral-sh/ruff-pre-commit dependency-version: 0.16.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 61041271354..4c714733de2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.15.22 + rev: v0.16.0 hooks: - id: ruff-check types_or: [python, pyi, jupyter, toml] From e19a5065c25c9e9ec5fe7ae026c3f38099a5a049 Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Fri, 24 Jul 2026 07:41:55 +0200 Subject: [PATCH 2/2] Type check with 0.16.0 --- pyproject.toml | 2 +- src/qcodes/instrument/delegate/delegate_instrument.py | 4 ++-- src/qcodes/instrument/visa.py | 2 +- src/qcodes/instrument_drivers/mock_instruments/__init__.py | 2 +- src/qcodes/instrument_drivers/yokogawa/Yokogawa_GS200.py | 4 ++-- tests/parameter/conftest.py | 6 +++--- tests/parameter/test_get_set_wrapping.py | 2 +- tests/parameter/test_snapshot.py | 4 ++-- tests/validators/test_multiples.py | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d350ef8b96c..c83022134df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -257,7 +257,7 @@ select = [ # PLxxxx are pylint lints that generate a fair amount of warnings # it may be worth fixing some or these in the future # PYI036 disable until https://github.com/astral-sh/ruff/issues/9794 is fixed -ignore = ["E501", "G004", "PLR2004", "PLR0913", "PLR0911", "PLR0912", "PLR0915", "PLW0602", "PLW0603", "PLW2901", "PYI036"] +ignore = ["E501", "G004", "PLR2004", "PLR0913", "PLR0911", "PLR0912", "PLR0915", "PLW0602", "PLW0603", "PLW2901", "PYI036", "PLR0917"] # we want to explicitly use the micro symbol # not the greek letter diff --git a/src/qcodes/instrument/delegate/delegate_instrument.py b/src/qcodes/instrument/delegate/delegate_instrument.py index 5acc94c6206..27a3c9f308f 100644 --- a/src/qcodes/instrument/delegate/delegate_instrument.py +++ b/src/qcodes/instrument/delegate/delegate_instrument.py @@ -108,8 +108,8 @@ def __init__( self, name: str, station: Station, - parameters: None | (Mapping[str, Sequence[str]] | Mapping[str, str]) = None, - channels: None | (Mapping[str, Mapping[str, Any]] | Mapping[str, str]) = None, + parameters: (Mapping[str, Sequence[str]] | Mapping[str, str]) | None = None, + channels: (Mapping[str, Mapping[str, Any]] | Mapping[str, str]) | None = None, initial_values: Mapping[str, Any] | None = None, set_initial_values_on_load: bool = False, setters: Mapping[str, MutableMapping[str, Any]] | None = None, diff --git a/src/qcodes/instrument/visa.py b/src/qcodes/instrument/visa.py index de73a0f3787..4d91ce6b7e2 100644 --- a/src/qcodes/instrument/visa.py +++ b/src/qcodes/instrument/visa.py @@ -151,7 +151,7 @@ def __init__( self, name: str, address: str | None = None, - timeout: float | None | Literal["Unset"] = "Unset", + timeout: float | Literal["Unset"] | None = "Unset", terminator: str | Literal["Unset"] | None = "Unset", # noqa: PYI051 # while unset is redundant here we add it to communicate to the user that unset has special meaning device_clear: bool = True, diff --git a/src/qcodes/instrument_drivers/mock_instruments/__init__.py b/src/qcodes/instrument_drivers/mock_instruments/__init__.py index e0d411b8dc2..edd248da108 100644 --- a/src/qcodes/instrument_drivers/mock_instruments/__init__.py +++ b/src/qcodes/instrument_drivers/mock_instruments/__init__.py @@ -1130,7 +1130,7 @@ def get_field(self) -> float: self._field = val return self._field - def set_field(self, value: float, block: bool = True) -> None | float: + def set_field(self, value: float, block: bool = True) -> float | None: if self._field == value: return value diff --git a/src/qcodes/instrument_drivers/yokogawa/Yokogawa_GS200.py b/src/qcodes/instrument_drivers/yokogawa/Yokogawa_GS200.py index 488ca8e3d9d..a0de40fbb62 100644 --- a/src/qcodes/instrument_drivers/yokogawa/Yokogawa_GS200.py +++ b/src/qcodes/instrument_drivers/yokogawa/Yokogawa_GS200.py @@ -180,8 +180,8 @@ def __init__( # Set up mode cache. These will be filled in once the parent # is fully initialized. - self._range: None | float = None - self._unit: None | str = None + self._range: float | None = None + self._unit: str | None = None # Set up monitoring parameters if present: diff --git a/tests/parameter/conftest.py b/tests/parameter/conftest.py index 3225132ee3b..6e61f4265f8 100644 --- a/tests/parameter/conftest.py +++ b/tests/parameter/conftest.py @@ -41,7 +41,7 @@ def get_if_invalid(request: pytest.FixtureRequest) -> bool | Literal["NOT_PASSED @pytest.fixture(params=(True, False, None, NOT_PASSED)) -def update(request: pytest.FixtureRequest) -> bool | None | Literal["NOT_PASSED"]: +def update(request: pytest.FixtureRequest) -> bool | Literal["NOT_PASSED"] | None: return request.param @@ -151,7 +151,7 @@ def validate(self, value: T, context: str = "") -> None: class MemoryParameter(Parameter): - def __init__(self, get_cmd: None | Callable[[], Any] = None, **kwargs: Any): + def __init__(self, get_cmd: Callable[[], Any] | None = None, **kwargs: Any): self.set_values: list[Any] = [] self.get_values: list[Any] = [] super().__init__( @@ -162,7 +162,7 @@ def add_set_value(self, value: ParamDataType) -> None: self.set_values.append(value) def create_get_func( - self, func: None | Callable[[], ParamDataType] + self, func: Callable[[], ParamDataType] | None ) -> Callable[[], ParamDataType]: def get_func() -> ParamDataType: if func is not None: diff --git a/tests/parameter/test_get_set_wrapping.py b/tests/parameter/test_get_set_wrapping.py index ff75128271a..3bbe3416d5b 100644 --- a/tests/parameter/test_get_set_wrapping.py +++ b/tests/parameter/test_get_set_wrapping.py @@ -52,7 +52,7 @@ def test_parameter_with_overwritten_set_raises() -> None: ], ) def test_gettable_settable_attributes_with_get_set_cmd( - get_cmd: Literal[False] | None | Callable, set_cmd: Literal[False] | None | Callable + get_cmd: Literal[False] | Callable | None, set_cmd: Literal[False] | Callable | None ) -> None: a = Parameter(name="foo", get_cmd=get_cmd, set_cmd=set_cmd) expected_gettable = get_cmd is not False diff --git a/tests/parameter/test_snapshot.py b/tests/parameter/test_snapshot.py index 8cc09df3ff3..8f48d9ea8f7 100644 --- a/tests/parameter/test_snapshot.py +++ b/tests/parameter/test_snapshot.py @@ -20,7 +20,7 @@ def create_parameter( snapshot_get: bool | Literal["NOT_PASSED"], snapshot_value: bool | Literal["NOT_PASSED"], cache_is_valid: bool, - get_cmd: Callable[..., Any] | bool | None | Literal["NOT_PASSED"], + get_cmd: Callable[..., Any] | bool | Literal["NOT_PASSED"] | None, offset: float | Literal["NOT_PASSED"] = NOT_PASSED, ) -> Parameter: kwargs: dict[str, Any] = dict( @@ -72,7 +72,7 @@ def wrapped_func(*args: P.args, **kwargs: P.kwargs) -> T: def test_snapshot_contains_parameter_attributes( snapshot_get: bool | Literal["NOT_PASSED"], snapshot_value: bool | Literal["NOT_PASSED"], - get_cmd: None | Literal[False, "NOT_PASSED"], + get_cmd: Literal[False, "NOT_PASSED"] | None, cache_is_valid: bool, update: bool | Literal["NOT_PASSED"] | None, ) -> None: diff --git a/tests/validators/test_multiples.py b/tests/validators/test_multiples.py index d220aa694ff..cf3f894ca9e 100644 --- a/tests/validators/test_multiples.py +++ b/tests/validators/test_multiples.py @@ -15,7 +15,7 @@ divisors = (3, 7, 11, 13) not_divisors: tuple[ - int | float | str | None | bytes | list | dict | type[AClass] | AClass | Callable, + int | float | str | bytes | list | dict | type[AClass] | AClass | Callable | None, ..., ] = ( 0, @@ -64,7 +64,7 @@ np.int64(2), ] not_multiples: tuple[ - float | None | str | list | dict | bytes | type[AClass] | AClass | Callable, + float | str | list | dict | bytes | type[AClass] | AClass | Callable | None, ..., ] = ( 0.1,