From c4c6ef582567f017f053d094c44b191623469d42 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 23:23:45 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.16.0 → v3.17.0](https://github.com/asottile/pyupgrade/compare/v3.16.0...v3.17.0) --- .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 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] From b14a99db6b6e049b1d840eb953598103ee69055d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 23:24:25 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- babi/buf.py | 4 ++-- babi/file.py | 4 ++-- babi/history.py | 2 +- babi/hl/replace.py | 2 +- babi/perf.py | 2 +- babi/screen.py | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) 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()