mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-03-05 14:44:18 +08:00
Added __class_getitem__ (#4695)
Resolves #4682 Co-authored-by: hauntsaninja <>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user