@@ -3,9 +3,9 @@ from __future__ import annotations
33
44import inspect
55import os .path
6+ from collections .abc import Generator
67from typing import Any
78from typing import Callable
8- from typing import Generator
99from typing import NamedTuple
1010
1111import pycodestyle
@@ -42,7 +42,7 @@ class Call(NamedTuple):
4242 return cls (func .__name__ , inspect .isgeneratorfunction (func ), params )
4343
4444
45- def lines () -> Generator [str , None , None ]:
45+ def lines () -> Generator [str ]:
4646 logical = []
4747 physical = []
4848
@@ -58,8 +58,8 @@ def lines() -> Generator[str, None, None]:
5858 yield "# fmt: off"
5959 yield "from __future__ import annotations"
6060 yield ""
61+ yield "from collections.abc import Generator"
6162 yield "from typing import Any"
62- yield "from typing import Generator"
6363 yield ""
6464 imports = sorted (call .name for call in logical + physical )
6565 for name in imports :
@@ -71,7 +71,7 @@ def lines() -> Generator[str, None, None]:
7171 logical_params = {param for call in logical for param in call .params }
7272 for param in sorted (logical_params ):
7373 yield f" { param } : Any,"
74- yield ") -> Generator[tuple[int, str], None, None ]:"
74+ yield ") -> Generator[tuple[int, str]]:"
7575 yield ' """Run pycodestyle logical checks."""'
7676 for call in sorted (logical ):
7777 yield call .to_src ()
@@ -82,7 +82,7 @@ def lines() -> Generator[str, None, None]:
8282 physical_params = {param for call in physical for param in call .params }
8383 for param in sorted (physical_params ):
8484 yield f" { param } : Any,"
85- yield ") -> Generator[tuple[int, str], None, None ]:"
85+ yield ") -> Generator[tuple[int, str]]:"
8686 yield ' """Run pycodestyle physical checks."""'
8787 for call in sorted (physical ):
8888 yield call .to_src ()
0 commit comments