Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/qcodes/instrument/delegate/delegate_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/qcodes/instrument/visa.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/qcodes/instrument_drivers/yokogawa/Yokogawa_GS200.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions tests/parameter/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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__(
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/parameter/test_get_set_wrapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/parameter/test_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/validators/test_multiples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading