mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 20:01:29 +08:00
Enable --disallow-any-generics for stubs (#3288)
This commit is contained in:
committed by
Jelle Zijlstra
parent
23b353303b
commit
c32e1e2280
@@ -26,7 +26,7 @@ import sys
|
||||
# Sychronization primitives
|
||||
_LockLike = Union[synchronize.Lock, synchronize.RLock]
|
||||
def Barrier(parties: int,
|
||||
action: Optional[Callable] = ...,
|
||||
action: Optional[Callable[..., Any]] = ...,
|
||||
timeout: Optional[float] = ...) -> synchronize.Barrier: ...
|
||||
def BoundedSemaphore(value: int = ...) -> synchronize.BoundedSemaphore: ...
|
||||
def Condition(lock: Optional[_LockLike] = ...) -> synchronize.Condition: ...
|
||||
@@ -52,7 +52,7 @@ class Process():
|
||||
# TODO: set type of group to None
|
||||
def __init__(self,
|
||||
group: Any = ...,
|
||||
target: Optional[Callable] = ...,
|
||||
target: Optional[Callable[..., Any]] = ...,
|
||||
name: Optional[str] = ...,
|
||||
args: Iterable[Any] = ...,
|
||||
kwargs: Mapping[Any, Any] = ...,
|
||||
|
||||
@@ -41,7 +41,7 @@ class BaseContext(object):
|
||||
|
||||
def Barrier(self,
|
||||
parties: int,
|
||||
action: Optional[Callable] = ...,
|
||||
action: Optional[Callable[..., Any]] = ...,
|
||||
timeout: Optional[float] = ...) -> synchronize.Barrier: ...
|
||||
def BoundedSemaphore(self,
|
||||
value: int = ...) -> synchronize.BoundedSemaphore: ...
|
||||
@@ -52,9 +52,9 @@ class BaseContext(object):
|
||||
def RLock(self) -> synchronize.RLock: ...
|
||||
def Semaphore(self, value: int = ...) -> synchronize.Semaphore: ...
|
||||
|
||||
def Queue(self, maxsize: int = ...) -> queues.Queue: ...
|
||||
def JoinableQueue(self, maxsize: int = ...) -> queues.JoinableQueue: ...
|
||||
def SimpleQueue(self) -> queues.SimpleQueue: ...
|
||||
def Queue(self, maxsize: int = ...) -> queues.Queue[Any]: ...
|
||||
def JoinableQueue(self, maxsize: int = ...) -> queues.JoinableQueue[Any]: ...
|
||||
def SimpleQueue(self) -> queues.SimpleQueue[Any]: ...
|
||||
def Pool(
|
||||
self,
|
||||
processes: Optional[int] = ...,
|
||||
@@ -65,7 +65,7 @@ class BaseContext(object):
|
||||
def Process(
|
||||
self,
|
||||
group: Any = ...,
|
||||
target: Optional[Callable] = ...,
|
||||
target: Optional[Callable[..., Any]] = ...,
|
||||
name: Optional[str] = ...,
|
||||
args: Iterable[Any] = ...,
|
||||
kwargs: Mapping[Any, Any] = ...,
|
||||
|
||||
@@ -14,7 +14,7 @@ JoinableQueue = Queue
|
||||
|
||||
|
||||
class DummyProcess(threading.Thread):
|
||||
_children: weakref.WeakKeyDictionary
|
||||
_children: weakref.WeakKeyDictionary[Any, Any]
|
||||
_parent: threading.Thread
|
||||
_pid: None
|
||||
_start_called: int
|
||||
@@ -33,10 +33,10 @@ class Value(object):
|
||||
def __init__(self, typecode, value, lock=...) -> None: ...
|
||||
|
||||
|
||||
def Array(typecode, sequence, lock=...) -> array.array: ...
|
||||
def Array(typecode, sequence, lock=...) -> array.array[Any]: ...
|
||||
def Manager() -> Any: ...
|
||||
def Pool(processes=..., initializer=..., initargs=...) -> Any: ...
|
||||
def active_children() -> List: ...
|
||||
def active_children() -> List[Any]: ...
|
||||
def current_process() -> threading.Thread: ...
|
||||
def freeze_support() -> None: ...
|
||||
def shutdown() -> None: ...
|
||||
|
||||
@@ -21,9 +21,9 @@ class Connection(object):
|
||||
def poll(self, timeout: float = ...) -> bool: ...
|
||||
|
||||
class Listener(object):
|
||||
_backlog_queue: Optional[Queue]
|
||||
_backlog_queue: Optional[Queue[Any]]
|
||||
@property
|
||||
def address(self) -> Optional[Queue]: ...
|
||||
def address(self) -> Optional[Queue[Any]]: ...
|
||||
def __enter__(self: _TListener) -> _TListener: ...
|
||||
def __exit__(self, exc_type, exc_value, exc_tb) -> None: ...
|
||||
def __init__(self, address=..., family=..., backlog=...) -> None: ...
|
||||
|
||||
@@ -28,7 +28,7 @@ class BaseManager(ContextManager[BaseManager]):
|
||||
address: Union[str, Tuple[str, int]]
|
||||
def connect(self) -> None: ...
|
||||
@classmethod
|
||||
def register(cls, typeid: str, callable: Optional[Callable] = ...,
|
||||
def register(cls, typeid: str, callable: Optional[Callable[..., Any]] = ...,
|
||||
proxytype: Any = ...,
|
||||
exposed: Optional[Sequence[str]] = ...,
|
||||
method_to_typeid: Optional[Mapping[str, str]] = ...,
|
||||
@@ -43,7 +43,7 @@ class SyncManager(BaseManager, ContextManager[SyncManager]):
|
||||
def Event(self) -> threading.Event: ...
|
||||
def Lock(self) -> threading.Lock: ...
|
||||
def Namespace(self) -> _Namespace: ...
|
||||
def Queue(self, maxsize: int = ...) -> queue.Queue: ...
|
||||
def Queue(self, maxsize: int = ...) -> queue.Queue[Any]: ...
|
||||
def RLock(self) -> threading.RLock: ...
|
||||
def Semaphore(self, value: Any = ...) -> threading.Semaphore: ...
|
||||
def Array(self, typecode: Any, sequence: Sequence[_T]) -> Sequence[_T]: ...
|
||||
|
||||
@@ -19,14 +19,12 @@ AsyncResult = ApplyResult
|
||||
|
||||
class MapResult(ApplyResult[List[_T]]): ...
|
||||
|
||||
_IMIT = TypeVar('_IMIT', bound=IMapIterator)
|
||||
|
||||
class IMapIterator(Iterator[_T]):
|
||||
def __iter__(self: _IMIT) -> _IMIT: ...
|
||||
def __iter__(self: _S) -> _S: ...
|
||||
def next(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
def __next__(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
|
||||
class IMapUnorderedIterator(IMapIterator): ...
|
||||
class IMapUnorderedIterator(IMapIterator[_T]): ...
|
||||
|
||||
class Pool(ContextManager[Pool]):
|
||||
def __init__(self, processes: Optional[int] = ...,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Callable, ContextManager, Optional, Union
|
||||
from typing import Any, Callable, ContextManager, Optional, Union
|
||||
|
||||
from multiprocessing.context import BaseContext
|
||||
import threading
|
||||
@@ -9,7 +9,7 @@ _LockLike = Union[Lock, RLock]
|
||||
class Barrier(threading.Barrier):
|
||||
def __init__(self,
|
||||
parties: int,
|
||||
action: Optional[Callable] = ...,
|
||||
action: Optional[Callable[..., Any]] = ...,
|
||||
timeout: Optional[float] = ...,
|
||||
*
|
||||
ctx: BaseContext) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user