Add type information for asyncio.protocols

This commit is contained in:
David Soria Parra
2016-01-29 16:10:48 -08:00
parent 23ecee29d3
commit 3910b79361
2 changed files with 32 additions and 0 deletions

View File

@@ -4,6 +4,12 @@ from asyncio.coroutines import (
iscoroutinefunction as iscoroutinefunction,
iscoroutine as iscoroutine,
)
from asyncio.protocols import (
BaseProtocol as BaseProtocol,
Protocol as Protocol,
DatagramProtocol as DatagramProtocol,
SubprocessProtocol as SubprocessProtocol,
)
from asyncio.transports import (
BaseTransport as BaseTransport,
ReadTransport as ReadTransport,
@@ -41,6 +47,7 @@ from asyncio.queues import (
)
__all__ = (coroutines.__all__ +
protocols.__all__ +
transports.__all__ +
futures.__all__ +
tasks.__all__ +

View File

@@ -0,0 +1,25 @@
from typing import AnyStr
__all__ = ['BaseProtocol', 'Protocol', 'DatagramProtocol',
'SubprocessProtocol']
from asyncio import transports
class BaseProtocol:
def connection_made(self, transport: transports.BaseTransport) -> None: ...
def connection_lost(self, exc: Exception) -> None: ...
def pause_writing(self) -> None: ...
def resume_writing(self) -> None: ...
class Protocol(BaseProtocol):
def data_received(self, data: AnyStr) -> None: ...
def eof_received(self) -> bool: ...
class DatagramProtocol(BaseProtocol):
def datagram_received(self, data: AnyStr, addr: str) -> None: ...
def error_received(self, exc: Exception) -> None: ...
class SubprocessProtocol(BaseProtocol):
def pipe_data_received(self, fd: int, data: AnyStr) -> None: ...
def pipe_connection_lost(self, fd: int, exc: Exception) -> None: ...
def process_exited(self) -> None: ...