|
| 1 | +"""Backport of :mod:`typing` additions in Python 3.7.""" |
| 2 | + |
| 3 | +# pragma: no cover |
| 4 | +import typing |
| 5 | + |
| 6 | +__all__ = [ |
| 7 | + "AsyncContextManager", |
| 8 | + "AsyncGenerator", |
| 9 | + "ChainMap", |
| 10 | + "Counter", |
| 11 | + "Deque", |
| 12 | + "NoReturn", |
| 13 | + "Protocol", |
| 14 | +] |
| 15 | + |
| 16 | +if typing.TYPE_CHECKING: |
| 17 | + from typing import AsyncContextManager |
| 18 | +else: |
| 19 | + try: |
| 20 | + from typing import AsyncContextManager |
| 21 | + except ImportError: |
| 22 | + from typing import AsyncContextManager |
| 23 | + |
| 24 | +if typing.TYPE_CHECKING: |
| 25 | + from typing import AsyncGenerator |
| 26 | +else: |
| 27 | + try: |
| 28 | + from typing import AsyncGenerator |
| 29 | + except ImportError: # Python 3.6.0 |
| 30 | + from typing import AsyncGenerator |
| 31 | + |
| 32 | + |
| 33 | +if typing.TYPE_CHECKING: |
| 34 | + from typing import ChainMap |
| 35 | +else: |
| 36 | + try: |
| 37 | + from typing import ChainMap |
| 38 | + except ImportError: |
| 39 | + from typing import ChainMap |
| 40 | + |
| 41 | + |
| 42 | +if typing.TYPE_CHECKING: |
| 43 | + from typing import Counter |
| 44 | +else: |
| 45 | + try: |
| 46 | + from typing import Counter |
| 47 | + except ImportError: |
| 48 | + from typing import Counter |
| 49 | + |
| 50 | + |
| 51 | +if typing.TYPE_CHECKING: |
| 52 | + from typing import Deque |
| 53 | +else: |
| 54 | + try: |
| 55 | + from typing import Deque |
| 56 | + except ImportError: |
| 57 | + from typing import Deque |
| 58 | + |
| 59 | + |
| 60 | +if typing.TYPE_CHECKING: |
| 61 | + from typing import NoReturn |
| 62 | +else: |
| 63 | + try: |
| 64 | + from typing import NoReturn |
| 65 | + except ImportError: |
| 66 | + from typing import NoReturn |
| 67 | + |
| 68 | + |
| 69 | +if typing.TYPE_CHECKING: |
| 70 | + from typing import Protocol |
| 71 | +else: |
| 72 | + try: |
| 73 | + from typing import Protocol |
| 74 | + except ImportError: |
| 75 | + from typing_extensions import Protocol |
0 commit comments