mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
complete multiprocessing.connection stub (#1716)
Adds additional public members based on https://github.com/python/cpython/blob/master/Lib/multiprocessing/connection.py#L10 and https://docs.python.org/3/library/multiprocessing.html#multiprocessing-listeners-clients. I found some discrepancies in the docs while adding these stubs and filed python/cpython#4304 to address them.
This commit is contained in:
committed by
Matthias Kramm
parent
324f1761f4
commit
9390a49600
@@ -1,4 +1,29 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any, Iterable, List, Optional, Tuple, Type, Union
|
||||
import socket
|
||||
import sys
|
||||
import types
|
||||
|
||||
# https://docs.python.org/3/library/multiprocessing.html#address-formats
|
||||
_Address = Union[str, Tuple[str, int]]
|
||||
|
||||
def deliver_challenge(connection: Connection, authkey: bytes) -> None: ...
|
||||
def answer_challenge(connection: Connection, authkey: bytes) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def wait(object_list: Iterable[Union[Connection, socket.socket, int]], timeout: Optional[float] = ...) -> List[Union[Connection, socket.socket, int]]: ...
|
||||
def Client(address: _Address, family: Optional[str] = ..., authkey: Optional[bytes] = ...) -> Connection: ...
|
||||
def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ...
|
||||
|
||||
class Listener:
|
||||
def __init__(self, address: Optional[_Address] = ..., family: Optional[str] = ..., backlog: int = ..., authkey: Optional[bytes] = ...) -> None: ...
|
||||
def accept(self) -> Connection: ...
|
||||
def close(self) -> None: ...
|
||||
@property
|
||||
def address(self) -> _Address: ...
|
||||
@property
|
||||
def last_accepted(self) -> Optional[_Address]: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def __enter__(self) -> Listener: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], exc_tb: Optional[types.TracebackType]) -> None: ...
|
||||
|
||||
class Connection:
|
||||
def close(self) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user