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

@@ -1,7 +1,7 @@
import socket
import sys
from types import TracebackType
from typing import Any, BinaryIO, Iterable, List, NoReturn, Optional, Tuple, Type, Union, overload
from typing import Any, BinaryIO, Iterable, List, NoReturn, Optional, Sequence, Tuple, Type, Union, overload
if sys.version_info >= (3, 8):
# These are based in socket, maybe move them out into _typeshed.pyi or such
@@ -44,13 +44,17 @@ if sys.version_info >= (3, 8):
def ioctl(self, control: int, option: Union[int, Tuple[int, int, int], bool]) -> NoReturn: ...
def listen(self, __backlog: int = ...) -> None: ...
def makefile(self) -> BinaryIO: ...
def sendfile(self, file, offset: int = ..., count: Optional[int] = ...) -> int: ...
def sendfile(self, file: BinaryIO, offset: int = ..., count: Optional[int] = ...) -> int: ...
def close(self) -> None: ...
def detach(self) -> int: ...
if sys.platform == "linux":
def sendmsg_afalg(self, msg=..., *, op, iv=..., assoclen=..., flags=...) -> int: ...
def sendmsg_afalg(
self, msg: Iterable[bytes] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
) -> int: ...
else:
def sendmsg_afalg(self, msg=..., *, op, iv=..., assoclen=..., flags=...) -> NoReturn: ...
def sendmsg_afalg(
self, msg: Iterable[bytes] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
) -> NoReturn: ...
def sendmsg(
self, __buffers: Iterable[bytes], __ancdata: Iterable[_CMSG] = ..., __flags: int = ..., __address: _Address = ...
) -> int: ...

View File

@@ -3,7 +3,7 @@ from types import TracebackType
from typing import Callable, Optional, Protocol, Tuple, Type
class _WarnFunction(Protocol):
def __call__(self, message: str, category: Type[Warning], source: PipeHandle): ...
def __call__(self, message: str, category: Type[Warning], source: PipeHandle) -> None: ...
BUFSIZE: int
PIPE: int