Skip to content

Commit ee54c6a

Browse files
authored
support type ignores with codes (#47)
* support type ignores with codes * format * add missing newline
1 parent ddda0ff commit ee54c6a

File tree

4 files changed

+97
-84
lines changed

4 files changed

+97
-84
lines changed

test_files/type_ignore.expected.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,28 @@
22
from contextvars import copy_context as _copy_context
33
import sys
44
import typing
5+
from typing import Annotated # type: ignore[foo-bar]
56
from typing import Any
7+
from typing import Awaitable # type: ignore[123]
8+
from typing import ByteString # type: ignore[foo-bar] # noqa F501
69
from typing import Callable # type: ignore # noqa F401
10+
from typing import ClassVar # type: ignore[123] # noqa F123
711
from typing import Coroutine
812

913
import greenlet # type: ignore # noqa F401
1014

1115

1216
# keep imports around
13-
a1 = Any
14-
a2 = Callable
15-
a3 = Coroutine
16-
a4 = _copy_context
17-
a5 = sys
18-
a6 = typing
19-
a7 = asyncio
17+
vars = [
18+
Any,
19+
Callable,
20+
Coroutine,
21+
_copy_context,
22+
sys,
23+
typing,
24+
asyncio,
25+
Annotated,
26+
Awaitable,
27+
ByteString,
28+
ClassVar,
29+
]

test_files/type_ignore.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@
55
import greenlet # type: ignore # noqa F401
66
from typing import Any
77
from typing import Callable # type: ignore # noqa F401
8+
from typing import ByteString # type: ignore[foo-bar] # noqa F501
89
from typing import Coroutine
10+
from typing import Annotated # type: ignore[foo-bar]
11+
from typing import ClassVar # type: ignore[123] # noqa F123
12+
from typing import Awaitable # type: ignore[123]
913

1014

1115
# keep imports around
12-
a1 = Any
13-
a2 = Callable
14-
a3 = Coroutine
15-
a4 = _copy_context
16-
a5 = sys
17-
a6 = typing
18-
a7 = asyncio
16+
vars = [
17+
Any,
18+
Callable,
19+
Coroutine,
20+
_copy_context,
21+
sys,
22+
typing,
23+
asyncio,
24+
Annotated,
25+
Awaitable,
26+
ByteString,
27+
ClassVar,
28+
]

tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010

1111
class ImportsTest(unittest.TestCase):
12+
maxDiff = None
13+
1214
@contextlib.contextmanager
1315
def _capture_stdout(self):
1416
buf = io.StringIO()

0 commit comments

Comments
 (0)