Added some missing types from various stdlib stubs (#4466)

This commit is contained in:
Eric Traut
2020-08-29 16:45:36 -07:00
committed by GitHub
parent 3c20675813
commit bbd8c96e34
10 changed files with 73 additions and 45 deletions

View File

@@ -2,7 +2,7 @@ import array
import threading
import weakref
from queue import Queue as Queue
from typing import Any, List, Optional
from typing import Any, Callable, Iterable, List, Mapping, Optional, Sequence
JoinableQueue = Queue
Barrier = threading.Barrier
@@ -19,7 +19,14 @@ class DummyProcess(threading.Thread):
_pid: None
_start_called: int
exitcode: Optional[int]
def __init__(self, group=..., target=..., name=..., args=..., kwargs=...) -> None: ...
def __init__(
self,
group: Any = ...,
target: Optional[Callable[..., Any]] = ...,
name: Optional[str] = ...,
args: Iterable[Any] = ...,
kwargs: Mapping[str, Any] = ...,
) -> None: ...
Process = DummyProcess
@@ -32,11 +39,13 @@ class Value:
_typecode: Any
_value: Any
value: Any
def __init__(self, typecode, value, lock=...) -> None: ...
def __init__(self, typecode: Any, value: Any, lock: Any = ...) -> None: ...
def Array(typecode, sequence, lock=...) -> array.array[Any]: ...
def Array(typecode: Any, sequence: Sequence[Any], lock: Any = ...) -> array.array[Any]: ...
def Manager() -> Any: ...
def Pool(processes=..., initializer=..., initargs=...) -> Any: ...
def Pool(
processes: Optional[int] = ..., initializer: Optional[Callable[..., Any]] = ..., initargs: Iterable[Any] = ...
) -> Any: ...
def active_children() -> List[Any]: ...
def current_process() -> threading.Thread: ...
def freeze_support() -> None: ...

View File

@@ -1,10 +1,12 @@
from queue import Queue
from typing import Any, List, Optional, Tuple, TypeVar
from types import TracebackType
from typing import Any, List, Optional, Tuple, Type, TypeVar, Union
families: List[None]
_TConnection = TypeVar("_TConnection", bound=Connection)
_TListener = TypeVar("_TListener", bound=Listener)
_Address = Union[str, Tuple[str, int]]
class Connection(object):
_in: Any
@@ -14,8 +16,10 @@ class Connection(object):
send: Any
send_bytes: Any
def __enter__(self: _TConnection) -> _TConnection: ...
def __exit__(self, exc_type, exc_value, exc_tb) -> None: ...
def __init__(self, _in, _out) -> None: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...
def __init__(self, _in: Any, _out: Any) -> None: ...
def close(self) -> None: ...
def poll(self, timeout: float = ...) -> bool: ...
@@ -24,10 +28,12 @@ class Listener(object):
@property
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: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> None: ...
def __init__(self, address: Optional[_Address] = ..., family: Optional[int] = ..., backlog: int = ...) -> None: ...
def accept(self) -> Connection: ...
def close(self) -> None: ...
def Client(address) -> Connection: ...
def Client(address: _Address) -> Connection: ...
def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ...