Skip to content

Commit cc54632

Browse files
committed
remove AsyncGenerator from mypy_extensions
Probably not worth it
1 parent 90ed80d commit cc54632

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

extensions/mypy_extensions.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,12 @@
66
"""
77

88
# NOTE: This module must support Python 2.7 in addition to Python 3.x
9-
__all__ = ['TypedDict', 'AsyncGenerator']
109

1110
import sys
1211
# _type_check is NOT a part of public typing API, it is used here only to mimic
1312
# the (convenient) behavior of types provided by typing module.
1413
from typing import _type_check # type: ignore
1514

16-
if sys.version_info >= (3, 6):
17-
# if our typing version doesn't have https://github.com/python/typing/pull/346, emulate it
18-
try:
19-
from typing import AsyncGenerator
20-
except ImportError:
21-
import collections
22-
from typing import AsyncIterator, Generic, _generic_new, T_co, T_contra
23-
24-
_AG_base = collections.AsyncGenerator
25-
26-
# need exec because the class keyword arg is a syntax error in 2.7
27-
exec("""
28-
class AsyncGenerator(AsyncIterator[T_co], Generic[T_co, T_contra],
29-
extra=_AG_base):
30-
__slots__ = ()
31-
32-
def __new__(cls, *args, **kwds):
33-
if _geqv(cls, AsyncGenerator):
34-
raise TypeError("Type AsyncGenerator cannot be instantiated; "
35-
"create a subclass instead")
36-
return _generic_new(_AG_base, cls, *args, **kwds)
37-
""")
38-
3915

4016
def _check_fails(cls, other):
4117
try:

test-data/unit/lib-stub/mypy_extensions.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Dict, Type, TypeVar, AsyncGenerator as AsyncGenerator
1+
from typing import Dict, Type, TypeVar
22

33
T = TypeVar('T')
44

0 commit comments

Comments
 (0)