Added __class_getitem__ (#4695)

Resolves #4682

Co-authored-by: hauntsaninja <>
This commit is contained in:
Utsav
2020-10-23 02:35:04 +05:30
committed by GitHub
parent 5927e5ca30
commit 6f943d43ea
32 changed files with 205 additions and 6 deletions

View File

@@ -5,6 +5,9 @@ from logging import Logger
from types import TracebackType
from typing import Any, Callable, Container, Generic, Iterable, Iterator, List, Optional, Protocol, Set, Tuple, TypeVar
if sys.version_info >= (3, 9):
from types import GenericAlias
FIRST_COMPLETED: str
FIRST_EXCEPTION: str
ALL_COMPLETED: str
@@ -54,6 +57,8 @@ class Future(Generic[_T]):
def exception_info(self, timeout: Optional[float] = ...) -> Tuple[Any, Optional[TracebackType]]: ...
def set_exception(self, exception: Any) -> None: ...
def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
class Executor:
if sys.version_info >= (3, 9):

View File

@@ -7,6 +7,9 @@ if sys.version_info >= (3, 7):
from ._base import BrokenExecutor
class BrokenThreadPool(BrokenExecutor): ...
if sys.version_info >= (3, 9):
from types import GenericAlias
_S = TypeVar("_S")
class ThreadPoolExecutor(Executor):
@@ -30,3 +33,5 @@ class _WorkItem(Generic[_S]):
kwargs: Mapping[str, Any]
def __init__(self, future: Future[_S], fn: Callable[..., _S], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
def run(self) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...