Added some missing type annotations in stdlib stubs. (#4418)

Co-authored-by: Eric Traut <erictr@microsoft.com>
This commit is contained in:
Eric Traut
2020-08-08 11:49:37 -07:00
committed by GitHub
parent 030e5ad1dd
commit f46fb7ff59
16 changed files with 34 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
import contextvars
from typing import Callable, List, Sequence, Tuple
from typing import Any, Callable, List, Sequence, Tuple
from typing_extensions import Literal
from . import futures
@@ -9,5 +9,5 @@ _CANCELLED: Literal["CANCELLED"] # undocumented
_FINISHED: Literal["FINISHED"] # undocumented
def isfuture(obj: object) -> bool: ...
def _format_callbacks(cb: Sequence[Tuple[Callable[[futures.Future], None], contextvars.Context]]) -> str: ... # undocumented
def _future_repr_info(future: futures.Future) -> List[str]: ... # undocumented
def _format_callbacks(cb: Sequence[Tuple[Callable[[futures.Future[Any]], None], contextvars.Context]]) -> str: ... # undocumented
def _future_repr_info(future: futures.Future[Any]) -> List[str]: ... # undocumented

View File

@@ -10,10 +10,10 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
_closed: bool # undocumented
_protocol: protocols.SubprocessProtocol # undocumented
_loop: events.AbstractEventLoop # undocumented
_proc: Optional[subprocess.Popen] # undocumented
_proc: Optional[subprocess.Popen[Any]] # undocumented
_pid: Optional[int] # undocumented
_returncode: Optional[int] # undocumented
_exit_waiters: List[futures.Future] # undocumented
_exit_waiters: List[futures.Future[Any]] # undocumented
_pending_calls: Deque[Tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented
_pipes: Dict[int, _File] # undocumented
_finished: bool # undocumented
@@ -27,7 +27,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
stdout: _File,
stderr: _File,
bufsize: int,
waiter: Optional[futures.Future] = ...,
waiter: Optional[futures.Future[Any]] = ...,
extra: Optional[Any] = ...,
**kwargs: Any,
) -> None: ...
@@ -40,7 +40,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
stderr: _File,
bufsize: int,
**kwargs: Any,
): ... # undocumented
) -> None: ... # undocumented
def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ...
def get_protocol(self) -> protocols.BaseProtocol: ...
def is_closing(self) -> bool: ...
@@ -52,7 +52,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
def send_signal(self, signal: int) -> None: ... # type: ignore
def terminate(self) -> None: ...
def kill(self) -> None: ...
async def _connect_pipes(self, waiter: Optional[futures.Future]) -> None: ... # undocumented
async def _connect_pipes(self, waiter: Optional[futures.Future[Any]]) -> None: ... # undocumented
def _call(self, cb: Callable[..., Any], *data: Any) -> None: ... # undocumented
def _pipe_connection_lost(self, fd: int, exc: Optional[BaseException]) -> None: ... # undocumented
def _pipe_data_received(self, fd: int, data: bytes) -> None: ... # undocumented

View File

@@ -1,9 +1,9 @@
from _typeshed import AnyPath
from types import FrameType
from typing import List, Optional
from typing import Any, List, Optional
from . import tasks
def _task_repr_info(task: tasks.Task) -> List[str]: ... # undocumented
def _task_get_stack(task: tasks.Task, limit: Optional[int]) -> List[FrameType]: ... # undocumented
def _task_print_stack(task: tasks.Task, limit: Optional[int], file: AnyPath): ... # undocumented
def _task_repr_info(task: tasks.Task[Any]) -> List[str]: ... # undocumented
def _task_get_stack(task: tasks.Task[Any], limit: Optional[int]) -> List[FrameType]: ... # undocumented
def _task_print_stack(task: tasks.Task[Any], limit: Optional[int], file: AnyPath) -> None: ... # undocumented

View File

@@ -81,7 +81,7 @@ class SSLProtocol(protocols.Protocol):
_extra: Dict[str, Any]
_write_backlog: Deque[Tuple[bytes, int]]
_write_buffer_size: int
_waiter: futures.Future
_waiter: futures.Future[Any]
_loop: events.AbstractEventLoop
_app_transport: _SSLProtocolTransport
_sslpipe: Optional[_SSLPipe]
@@ -100,7 +100,7 @@ class SSLProtocol(protocols.Protocol):
loop: events.AbstractEventLoop,
app_protocol: protocols.BaseProtocol,
sslcontext: ssl.SSLContext,
waiter: futures.Future,
waiter: futures.Future[Any],
server_side: bool = ...,
server_hostname: Optional[str] = ...,
call_connection_made: bool = ...,

View File

@@ -5,5 +5,8 @@ from . import events
if sys.version_info >= (3, 8):
async def staggered_race(
coro_fns: Iterable[Callable[[], Awaitable]], delay: Optional[float], *, loop: Optional[events.AbstractEventLoop] = ...
coro_fns: Iterable[Callable[[], Awaitable[Any]]],
delay: Optional[float],
*,
loop: Optional[events.AbstractEventLoop] = ...,
) -> Tuple[Any, Optional[int], List[Optional[Exception]]]: ...