diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bf1666c..e7c1878 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,7 @@ repos: hooks: - id: add-trailing-comma - repo: https://github.com/asottile/pyupgrade - rev: v3.16.0 + rev: v3.17.0 hooks: - id: pyupgrade args: [--py38-plus] diff --git a/babi/buf.py b/babi/buf.py index 347bc39..e8e94f4 100644 --- a/babi/buf.py +++ b/babi/buf.py @@ -22,7 +22,7 @@ def _diff_codes( a: list[str], b: list[str], -) -> Generator[tuple[str, int, int, int, int], None, None]: +) -> Generator[tuple[str, int, int, int, int]]: matcher = difflib.SequenceMatcher(a=a, b=b) for op, i1, i2, j1, j2 in reversed(matcher.get_opcodes()): if op == 'replace': @@ -201,7 +201,7 @@ def clear_callbacks(self) -> None: self._del_callbacks.clear() @contextlib.contextmanager - def record(self) -> Generator[list[Modification], None, None]: + def record(self) -> Generator[list[Modification]]: modifications: list[Modification] = [] def set_cb(buf: Buf, idx: int, victim: str) -> None: diff --git a/babi/file.py b/babi/file.py index 7a0d353..852c197 100644 --- a/babi/file.py +++ b/babi/file.py @@ -948,7 +948,7 @@ def edit_action_context( self, name: str, *, final: bool, - ) -> Generator[None, None, None]: + ) -> Generator[None]: continue_last = self._continue_last_action(name) if not continue_last and self.undo_stack: self.undo_stack[-1].final = True @@ -980,7 +980,7 @@ def edit_action_context( self.undo_stack.append(action) @contextlib.contextmanager - def select(self) -> Generator[None, None, None]: + def select(self) -> Generator[None]: if self.selection.start is None: start = (self.buf.y, self.buf.x) else: diff --git a/babi/history.py b/babi/history.py index a4fceb5..806d7f0 100644 --- a/babi/history.py +++ b/babi/history.py @@ -15,7 +15,7 @@ def __init__(self) -> None: self.prev: dict[str, str] = {} @contextlib.contextmanager - def save(self) -> Generator[None, None, None]: + def save(self) -> Generator[None]: history_dir = xdg_data('history') os.makedirs(history_dir, exist_ok=True) for filename in os.listdir(history_dir): diff --git a/babi/hl/replace.py b/babi/hl/replace.py index a52e7f8..5f2c361 100644 --- a/babi/hl/replace.py +++ b/babi/hl/replace.py @@ -23,7 +23,7 @@ def register_callbacks(self, buf: Buf) -> None: """our highlight regions are populated in other ways""" @contextlib.contextmanager - def region(self, y: int, x: int, end: int) -> Generator[None, None, None]: + def region(self, y: int, x: int, end: int) -> Generator[None]: # XXX: this assumes pair 1 is the background attr = curses.A_REVERSE | curses.A_DIM | curses.color_pair(1) self.regions[y] = (HL(x=x, end=end, attr=attr),) diff --git a/babi/perf.py b/babi/perf.py index e2d8056..9bb2d76 100644 --- a/babi/perf.py +++ b/babi/perf.py @@ -42,7 +42,7 @@ def save_profiles(self, filename: str) -> None: @contextlib.contextmanager -def perf_log(filename: str | None) -> Generator[Perf, None, None]: +def perf_log(filename: str | None) -> Generator[Perf]: perf = Perf() if filename is None: yield perf diff --git a/babi/screen.py b/babi/screen.py index e26c702..60b7a38 100644 --- a/babi/screen.py +++ b/babi/screen.py @@ -839,7 +839,7 @@ def retheme(self) -> None: } @contextlib.contextmanager - def retheme_handler(self) -> Generator[None, None, None]: + def retheme_handler(self) -> Generator[None]: if sys.platform == 'win32': # pragma: win32 cover yield # no signal handling on windows! else: @@ -879,7 +879,7 @@ def _init_screen() -> curses._CursesWindow: @contextlib.contextmanager -def make_stdscr() -> Generator[curses._CursesWindow, None, None]: +def make_stdscr() -> Generator[curses._CursesWindow]: """essentially `curses.wrapper` but split out to implement ^Z""" try: yield _init_screen()