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

@@ -30,6 +30,9 @@ if sys.version_info >= (3, 8):
_SharedMemory = SharedMemory
_ShareableList = ShareableList
if sys.version_info >= (3, 9):
from types import GenericAlias
_T = TypeVar("_T")
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
@@ -89,6 +92,8 @@ class ValueProxy(BaseProxy, Generic[_T]):
def get(self) -> _T: ...
def set(self, value: _T) -> None: ...
value: _T
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
# Returned by BaseManager.get_server()
class Server:

View File

@@ -1,5 +1,9 @@
import sys
from typing import Any, Callable, ContextManager, Generic, Iterable, Iterator, List, Mapping, Optional, TypeVar
if sys.version_info >= (3, 9):
from types import GenericAlias
_PT = TypeVar("_PT", bound=Pool)
_S = TypeVar("_S")
_T = TypeVar("_T")
@@ -9,6 +13,8 @@ class ApplyResult(Generic[_T]):
def wait(self, timeout: Optional[float] = ...) -> None: ...
def ready(self) -> bool: ...
def successful(self) -> bool: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
# alias created during issue #17805
AsyncResult = ApplyResult

View File

@@ -1,6 +1,10 @@
import queue
import sys
from typing import Any, Generic, Optional, TypeVar
if sys.version_info >= (3, 9):
from types import GenericAlias
_T = TypeVar("_T")
class Queue(queue.Queue[_T]):
@@ -27,3 +31,5 @@ class SimpleQueue(Generic[_T]):
def empty(self) -> bool: ...
def get(self) -> _T: ...
def put(self, item: _T) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

View File

@@ -1,5 +1,8 @@
import sys
from typing import Generic, Iterable, Optional, Tuple, TypeVar
from typing import Any, Generic, Iterable, Optional, Tuple, TypeVar
if sys.version_info >= (3, 9):
from types import GenericAlias
_S = TypeVar("_S")
_SLT = TypeVar("_SLT", int, float, bool, str, bytes, None)
@@ -26,3 +29,5 @@ if sys.version_info >= (3, 8):
def format(self) -> str: ...
def count(self, value: _SLT) -> int: ...
def index(self, value: _SLT) -> int: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...