@@ -3,9 +3,9 @@ from __future__ import annotations
3
3
4
4
import inspect
5
5
import os .path
6
+ from collections .abc import Generator
6
7
from typing import Any
7
8
from typing import Callable
8
- from typing import Generator
9
9
from typing import NamedTuple
10
10
11
11
import pycodestyle
@@ -42,7 +42,7 @@ class Call(NamedTuple):
42
42
return cls (func .__name__ , inspect .isgeneratorfunction (func ), params )
43
43
44
44
45
- def lines () -> Generator [str , None , None ]:
45
+ def lines () -> Generator [str ]:
46
46
logical = []
47
47
physical = []
48
48
@@ -58,8 +58,8 @@ def lines() -> Generator[str, None, None]:
58
58
yield "# fmt: off"
59
59
yield "from __future__ import annotations"
60
60
yield ""
61
+ yield "from collections.abc import Generator"
61
62
yield "from typing import Any"
62
- yield "from typing import Generator"
63
63
yield ""
64
64
imports = sorted (call .name for call in logical + physical )
65
65
for name in imports :
@@ -71,7 +71,7 @@ def lines() -> Generator[str, None, None]:
71
71
logical_params = {param for call in logical for param in call .params }
72
72
for param in sorted (logical_params ):
73
73
yield f" { param } : Any,"
74
- yield ") -> Generator[tuple[int, str], None, None ]:"
74
+ yield ") -> Generator[tuple[int, str]]:"
75
75
yield ' """Run pycodestyle logical checks."""'
76
76
for call in sorted (logical ):
77
77
yield call .to_src ()
@@ -82,7 +82,7 @@ def lines() -> Generator[str, None, None]:
82
82
physical_params = {param for call in physical for param in call .params }
83
83
for param in sorted (physical_params ):
84
84
yield f" { param } : Any,"
85
- yield ") -> Generator[tuple[int, str], None, None ]:"
85
+ yield ") -> Generator[tuple[int, str]]:"
86
86
yield ' """Run pycodestyle physical checks."""'
87
87
for call in sorted (physical ):
88
88
yield call .to_src ()
0 commit comments