mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-28 13:52:12 +08:00
Stub: asyncore.pyi (#498)
* Stub: asyncore.pyi I can't really test this stub since I don't use this module. I believe it's not far from the real thing. It's based on the source code and not on the documentation. https://hg.python.org/cpython/file/default/Lib/asyncore.py * Option ->Optional * add hint to count, remove addr * make read/write explicit functions * add synchat.pyi, move to 2and3 * change sys.version_info test * try reversing the syntax
This commit is contained in:
41
stdlib/2and3/asynchat.pyi
Normal file
41
stdlib/2and3/asynchat.pyi
Normal file
@@ -0,0 +1,41 @@
|
||||
from typing import Union, Tuple, Sequence
|
||||
from abc import abstractmethod
|
||||
|
||||
import asyncore
|
||||
import socket
|
||||
|
||||
class simple_producer:
|
||||
def __init__(self, data: str, buffer_size: int = ...) -> None: ...
|
||||
def more(self) -> str: ...
|
||||
|
||||
class async_chat (asyncore.dispatcher):
|
||||
ac_in_buffer_size = ... # type: int
|
||||
ac_out_buffer_size = ... # type: int
|
||||
def __init__(self, sock: socket.socket = None, map: asyncore._maptype = None) -> None: ...
|
||||
|
||||
@abstractmethod
|
||||
def collect_incoming_data(self, data: str) -> None: ...
|
||||
@abstractmethod
|
||||
def found_terminator(self) -> None: ...
|
||||
def set_terminator(self, term: Union[str, int, None]) -> None: ...
|
||||
def get_terminator(self) -> Union[str, int, None]: ...
|
||||
def handle_read(self) -> None: ...
|
||||
def handle_write(self) -> None: ...
|
||||
def handle_close(self) -> None: ...
|
||||
def push(self, data: str) -> None: ...
|
||||
def push_with_producer(self, producer: simple_producer) -> None: ...
|
||||
def readable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
def close_when_done(self) -> None: ...
|
||||
def initiate_send(self) -> None: ...
|
||||
def discard_buffers(self) -> None: ...
|
||||
|
||||
import sys
|
||||
if sys.version_info < (3, 0, 0):
|
||||
class fifo:
|
||||
def __init__(self, list: Sequence[Union[str, simple_producer]] = ...) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def is_empty(self) -> bool: ...
|
||||
def first(self) -> str: ...
|
||||
def push(self, data: Union[str, simple_producer]) -> None: ...
|
||||
def pop(self) -> Tuple[int, str]: ...
|
||||
Reference in New Issue
Block a user