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 .github/package.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"devDependencies": {"pyright": "1.1.408"}}
{"devDependencies": {"pyright": "1.1.409"}}
4 changes: 2 additions & 2 deletions src/qcodes/dataset/dond/do_nd_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import logging
from collections.abc import Callable, Iterator, Sequence
from collections.abc import Callable, Generator, Sequence
from contextlib import contextmanager
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -120,7 +120,7 @@ def _register_actions(


@contextmanager
def catch_interrupts() -> Iterator[Callable[[], MeasInterruptT | None]]:
def catch_interrupts() -> Generator[Callable[[], MeasInterruptT | None], None, None]:
interrupt_exception: MeasInterruptT | None = None
interrupt_raised = False

Expand Down
4 changes: 2 additions & 2 deletions src/qcodes/dataset/sqlite/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from qcodes.utils import DelayedKeyboardInterrupt

if TYPE_CHECKING:
from collections.abc import Iterator
from collections.abc import Generator

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -46,7 +46,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


@contextmanager
def atomic(conn: AtomicConnection) -> Iterator[AtomicConnection]:
def atomic(conn: AtomicConnection) -> Generator[AtomicConnection, None, None]:
"""
Guard a series of transactions as atomic.

Expand Down
4 changes: 2 additions & 2 deletions src/qcodes/dataset/sqlite/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from qcodes.utils.types import complex_types, numpy_floats, numpy_ints

if TYPE_CHECKING:
from collections.abc import Iterator
from collections.abc import Generator
from pathlib import Path

JournalMode = Literal["DELETE", "TRUNCATE", "PERSIST", "MEMORY", "WAL", "OFF"]
Expand Down Expand Up @@ -273,7 +273,7 @@ def initialise_or_create_database_at(
@contextmanager
def initialised_database_at(
db_file_with_abs_path: str | Path, *, journal_mode: JournalMode | None = "WAL"
) -> Iterator[None]:
) -> Generator[None, None, None]:
"""
Initialises or creates a database at the specified location, configures QCoDeS to use this as the
default database for the duration of the context, and restores the 'db_location' afterwards.
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 @@ -19,7 +19,7 @@
from .utils import TraceParameter

if TYPE_CHECKING:
from collections.abc import Iterator, Sequence
from collections.abc import Generator, Sequence

from typing_extensions import Unpack

Expand Down Expand Up @@ -208,7 +208,7 @@ def get_idn(self) -> dict[str, str | int | None]: # type: ignore[override]
}

@contextmanager
def syncing(self) -> Iterator[None]:
def syncing(self) -> Generator[None, None, None]:
"""
Context manager for syncing settings to Alazar card. It will
automatically call sync_settings_to_card at the end of the
Expand Down
4 changes: 2 additions & 2 deletions src/qcodes/logger/instrument_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from .logger import LevelType, get_console_handler, handler_level

if TYPE_CHECKING:
from collections.abc import Iterator, Mapping, MutableMapping, Sequence
from collections.abc import Generator, Mapping, MutableMapping, Sequence

from qcodes.instrument import InstrumentBase

Expand Down Expand Up @@ -157,7 +157,7 @@ def filter_instrument(
instrument: InstrumentBase | Sequence[InstrumentBase],
handler: logging.Handler | Sequence[logging.Handler] | None = None,
level: LevelType | None = None,
) -> Iterator[None]:
) -> Generator[None, None, None]:
"""
Context manager that adds a filter that only enables the log messages of
the supplied instruments to pass.
Expand Down
4 changes: 2 additions & 2 deletions src/qcodes/logger/log_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from collections.abc import Callable, Iterator, Sequence
from collections.abc import Callable, Generator, Sequence

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -156,7 +156,7 @@ def time_difference(
@contextmanager
def capture_dataframe(
level: LevelType = logging.DEBUG, logger: logging.Logger | None = None
) -> Iterator[tuple[logging.StreamHandler, Callable[[], pd.DataFrame]]]:
) -> Generator[tuple[logging.StreamHandler, Callable[[], pd.DataFrame]], None, None]:
"""
Context manager to capture the logs in a :class:`pd.DataFrame`

Expand Down
6 changes: 3 additions & 3 deletions src/qcodes/logger/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import TYPE_CHECKING, Any, Self

if TYPE_CHECKING:
from collections.abc import Iterator, Sequence
from collections.abc import Generator, Sequence
from types import TracebackType

import qcodes as qc
Expand Down Expand Up @@ -352,7 +352,7 @@ def running_in_test_or_tool() -> bool:
@contextmanager
def handler_level(
level: LevelType, handler: "logging.Handler | Sequence[logging.Handler]"
) -> "Iterator[None]":
) -> "Generator[None, None, None]":
"""
Context manager to temporarily change the level of handlers.

Expand All @@ -378,7 +378,7 @@ def handler_level(


@contextmanager
def console_level(level: LevelType) -> "Iterator[None]":
def console_level(level: LevelType) -> "Generator[None, None, None]":
"""
Context manager to temporarily change the level of the qcodes console
handler.
Expand Down
4 changes: 2 additions & 2 deletions src/qcodes/utils/attribute_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import TYPE_CHECKING, Any, ClassVar

if TYPE_CHECKING:
from collections.abc import Iterator, Sequence
from collections.abc import Generator, Sequence


class DelegateAttributes:
Expand Down Expand Up @@ -165,7 +165,7 @@ def checked_getattr_indexed(
@contextmanager
def attribute_set_to(
object_: object, attribute_name: str, new_value: Any
) -> "Iterator[None]":
) -> "Generator[None, None, None]":
"""
This context manager allows to change a given attribute of a given object
to a new value, and the original value is reverted upon exit of the context
Expand Down
3 changes: 3 additions & 0 deletions tests/parameter/test_group_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def test_update_group_parameter_reflected_in_cache_of_all_params() -> None:
assert before <= dummy.a.cache.timestamp
assert after >= dummy.a.cache.timestamp

assert dummy.b.cache.timestamp is not None
assert before <= dummy.b.cache.timestamp
assert after >= dummy.b.cache.timestamp

Expand All @@ -244,6 +245,7 @@ def test_get_group_param_updates_cache_of_other_param() -> None:
assert before <= dummy.a.cache.timestamp
assert after >= dummy.a.cache.timestamp

assert dummy.b.cache.timestamp is not None
assert before <= dummy.b.cache.timestamp
assert after >= dummy.b.cache.timestamp

Expand All @@ -267,6 +269,7 @@ def test_set_group_param_updates_cache_of_other_param() -> None:
assert before <= dummy.a.cache.timestamp
assert after >= dummy.a.cache.timestamp

assert dummy.b.cache.timestamp is not None
assert before <= dummy.b.cache.timestamp
assert after >= dummy.b.cache.timestamp

Expand Down
Loading