From 23ecee29d3555708325802c80b6b302b18a1fccf Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Fri, 29 Jan 2016 16:08:57 -0800 Subject: [PATCH] Add type information for asyncio.transports --- stdlib/3.4/asyncio/__init__.pyi | 9 +++++++ stdlib/3.4/asyncio/transports.pyi | 39 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 stdlib/3.4/asyncio/transports.pyi diff --git a/stdlib/3.4/asyncio/__init__.pyi b/stdlib/3.4/asyncio/__init__.pyi index 6c5dbe222..3b9a237ef 100644 --- a/stdlib/3.4/asyncio/__init__.pyi +++ b/stdlib/3.4/asyncio/__init__.pyi @@ -4,6 +4,14 @@ from asyncio.coroutines import ( iscoroutinefunction as iscoroutinefunction, iscoroutine as iscoroutine, ) +from asyncio.transports import ( + BaseTransport as BaseTransport, + ReadTransport as ReadTransport, + WriteTransport as WriteTransport, + Transport as Transport, + DatagramTransport as DatagramTransport, + SubprocessTransport as SubprocessTransport, +) from asyncio.futures import ( Future as Future, ) @@ -33,6 +41,7 @@ from asyncio.queues import ( ) __all__ = (coroutines.__all__ + + transports.__all__ + futures.__all__ + tasks.__all__ + events.__all__ + diff --git a/stdlib/3.4/asyncio/transports.pyi b/stdlib/3.4/asyncio/transports.pyi new file mode 100644 index 000000000..e12693079 --- /dev/null +++ b/stdlib/3.4/asyncio/transports.pyi @@ -0,0 +1,39 @@ +from typing import Dict, Any, TypeVar, Mapping, List + +__all__ = ['BaseTransport', 'ReadTransport', 'WriteTransport', + 'Transport', 'DatagramTransport', 'SubprocessTransport', + ] + +class BaseTransport: + def __init__(self, extra: Mapping[Any, Any] = ...) -> None: ... + def get_extra_info(self, name: Any, default: Any = ...) -> Any: ... + def is_closing(self) -> bool: ... + def close(self) -> None: ... + +class ReadTransport(BaseTransport): + def pause_reading(self) -> None: ... + def resume_reading(self) -> None: ... + +class WriteTransport(BaseTransport): + def set_write_buffer_limits( + self, high: int = ..., low: int = ...) -> None: ... + def get_write_buffer_size(self) -> int: ... + def write(self, data: Any) -> None: ... + def writelines(self, list_of_data: List[Any]): ... + def write_eof(self) -> None: ... + def can_write_eof(self) -> bool: ... + def abort(self) -> None: ... + +class Transport(ReadTransport, WriteTransport): ... + +class DatagramTransport(BaseTransport): + def sendto(self, data: Any, addr: str = ...) -> None: ... + def abort(self) -> None: ... + +class SubprocessTransport(BaseTransport): + def get_pid(self) -> int: ... + def get_returncode(self) -> int: ... + def get_pipe_transport(self, fd: int) -> BaseTransport: ... + def send_signal(self, signal: int) -> int: ... + def terminate(self) -> None: ... + def kill(self) -> None: ...