diff --git a/gen/go_code.py b/gen/go_code.py index 6f8e016c7..6165f6a8e 100755 --- a/gen/go_code.py +++ b/gen/go_code.py @@ -12,7 +12,7 @@ import struct import subprocess import sys import tarfile -from collections.abc import Iterator, Sequence +from collections.abc import Generator, Iterator, Sequence from contextlib import contextmanager, suppress from functools import lru_cache from itertools import chain @@ -742,7 +742,7 @@ const NoPreferenceThemeFileName = "{ThemeFile.no_preference.value}" @contextmanager -def replace_if_needed(path: str, show_diff: bool = False) -> Iterator[io.StringIO]: +def replace_if_needed(path: str, show_diff: bool = False) -> Generator[io.StringIO, None, None]: buf = io.StringIO() origb = sys.stdout sys.stdout = buf diff --git a/kitty/conf/utils.py b/kitty/conf/utils.py index aed140def..6475cfd40 100644 --- a/kitty/conf/utils.py +++ b/kitty/conf/utils.py @@ -159,7 +159,7 @@ class CurrentlyParsing: return CurrentlyParsing(self.line, self.number, self.file) @contextmanager - def set_line(self, line: str, number: int) -> Iterator['CurrentlyParsing']: + def set_line(self, line: str, number: int) -> Generator['CurrentlyParsing', None, None]: orig = self.line, self.number self.line = line self.number = number @@ -169,7 +169,7 @@ class CurrentlyParsing: self.line, self.number = orig @contextmanager - def set_file(self, file: str) -> Iterator['CurrentlyParsing']: + def set_file(self, file: str) -> Generator['CurrentlyParsing', None, None]: orig = self.file self.file = file try: diff --git a/kitty/utils.py b/kitty/utils.py index 7ff766dd0..61edc30e0 100644 --- a/kitty/utils.py +++ b/kitty/utils.py @@ -140,7 +140,7 @@ def log_error(*a: Any, **k: str) -> None: @contextmanager -def suppress_error_logging() -> Iterator[None]: +def suppress_error_logging() -> Generator[None, None, None]: before = getattr(log_error, 'redirect', suppress_error_logging) setattr(log_error, 'redirect', lambda *a: None) try: @@ -504,7 +504,7 @@ def set_echo(fd: int = -1, on: bool = False) -> tuple[int, list[int | list[bytes @contextmanager -def no_echo(fd: int = -1) -> Iterator[None]: +def no_echo(fd: int = -1) -> Generator[None, None, None]: import termios fd, old = set_echo(fd) @@ -1238,7 +1238,7 @@ def unlock_file(f: IO[bytes] | IO[str]) -> None: @contextmanager -def lock_with_file(path: str) -> Iterator[None]: +def lock_with_file(path: str) -> Generator[None, None, None]: """Take an exclusive advisory lock on path, waiting for it to become available. The lock file is created if needed and left in place, since unlinking it