From e891b0d0cc4f7d0a1e74195f649fd6b5f613ef50 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 00:07:16 +0000 Subject: [PATCH 1/3] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-mypy: v1.13.0 → v1.14.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.13.0...v1.14.1) --- .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 3c38354437e..2f1bae939aa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: exclude: ^src/blib2to3/ - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.13.0 + rev: v1.14.1 hooks: - id: mypy exclude: ^(docs/conf.py|scripts/generate_schema.py)$ From 7ae0064dd16a7e82d2f5b644381b9280a8da4259 Mon Sep 17 00:00:00 2001 From: Cooper Ry Lees Date: Tue, 7 Jan 2025 13:14:07 -0600 Subject: [PATCH 2/3] Fix wrapper's return types to be String or Text IO --- tests/test_black.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_black.py b/tests/test_black.py index 84061f10cdf..1475478d3b1 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -1355,8 +1355,11 @@ def test_reformat_one_with_stdin_empty(self) -> None: def _new_wrapper( output: io.StringIO, io_TextIOWrapper: type[io.TextIOWrapper] - ) -> Callable[[Any, Any], io.TextIOWrapper]: - def get_output(*args: Any, **kwargs: Any) -> io.TextIOWrapper: + ) -> Callable[[Any, Any], Union[io.StringIO, io.TextIOWrapper]]: + def get_output( + *args: Any, + **kwargs: Any + ) -> Union[io.StringIO, io.TextIOWrapper]: if args == (sys.stdout.buffer,): # It's `format_stdin_to_stdout()` calling `io.TextIOWrapper()`, # return our mock object. From 87ad9d5d329ebf8411e8eb79d646435ea65799e9 Mon Sep 17 00:00:00 2001 From: Cooper Ry Lees Date: Tue, 7 Jan 2025 13:34:54 -0600 Subject: [PATCH 3/3] Make formatting happy for CI black ... --- tests/test_black.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_black.py b/tests/test_black.py index 1475478d3b1..98d8ff886d7 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -1357,8 +1357,7 @@ def _new_wrapper( output: io.StringIO, io_TextIOWrapper: type[io.TextIOWrapper] ) -> Callable[[Any, Any], Union[io.StringIO, io.TextIOWrapper]]: def get_output( - *args: Any, - **kwargs: Any + *args: Any, **kwargs: Any ) -> Union[io.StringIO, io.TextIOWrapper]: if args == (sys.stdout.buffer,): # It's `format_stdin_to_stdout()` calling `io.TextIOWrapper()`,