mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-03-16 11:34:56 +08:00
Rework socket (#5545)
* Extract _socket.pyi from socket.pyi. * Extract _socket.socket from socket.socket. * Fix socket.family annotation. * Annotate SocketIO properly. * SocketType is an alias of _socket.socket. * Sort items in socket.pyi in the same order as in socket.py. * Remove socket.EINTR. * Use _typeshed.WriteableBuffer instead of custom alias. * Add errorTab (Windows only). * Add _socket.dup(). * Mark positional-only argments. * Remove constructors from socket exceptions. * socket.timeout is an alias for TimeoutError, starting with Python 3.10. * Use PEP 604 in changed lines. * Add alias for fileno arguments. * getaddrinfo() port can be bytes. * Explicitly override some SSLSocket methods. * Allow ReadableBuffer in _CMSG arguments.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import enum
|
||||
import socket
|
||||
import sys
|
||||
from _typeshed import StrPath
|
||||
from _typeshed import StrPath, WriteableBuffer
|
||||
from typing import Any, Callable, Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, Type, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
@@ -247,15 +247,18 @@ class SSLSocket(socket.socket):
|
||||
def connect(self, addr: Union[socket._Address, bytes]) -> None: ...
|
||||
def connect_ex(self, addr: Union[socket._Address, bytes]) -> int: ...
|
||||
def recv(self, buflen: int = ..., flags: int = ...) -> bytes: ...
|
||||
def recv_into(self, buffer: socket._WriteBuffer, nbytes: Optional[int] = ..., flags: int = ...) -> int: ...
|
||||
def recv_into(self, buffer: WriteableBuffer, nbytes: Optional[int] = ..., flags: int = ...) -> int: ...
|
||||
def recvfrom(self, buflen: int = ..., flags: int = ...) -> tuple[bytes, socket._RetAddress]: ...
|
||||
def recvfrom_into(
|
||||
self, buffer: socket._WriteBuffer, nbytes: Optional[int] = ..., flags: int = ...
|
||||
self, buffer: WriteableBuffer, nbytes: Optional[int] = ..., flags: int = ...
|
||||
) -> tuple[int, socket._RetAddress]: ...
|
||||
def send(self, data: bytes, flags: int = ...) -> int: ...
|
||||
def sendall(self, data: bytes, flags: int = ...) -> None: ...
|
||||
@overload
|
||||
def sendto(self, data: bytes, flags_or_addr: socket._Address) -> int: ...
|
||||
@overload
|
||||
def sendto(self, data: bytes, flags_or_addr: Union[int, socket._Address], addr: Optional[socket._Address] = ...) -> int: ...
|
||||
def shutdown(self, how: int) -> None: ...
|
||||
def read(self, len: int = ..., buffer: Optional[bytearray] = ...) -> bytes: ...
|
||||
def write(self, data: bytes) -> int: ...
|
||||
def do_handshake(self, block: bool = ...) -> None: ... # block is undocumented
|
||||
|
||||
Reference in New Issue
Block a user