mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-09-01 20:46:58 +08:00
add (overwrite with) mypy stubs, if available
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# Stubs for Queue (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class Empty(Exception): ...
|
||||
class Full(Exception): ...
|
||||
|
||||
class Queue:
|
||||
maxsize = ... # type: Any
|
||||
mutex = ... # type: Any
|
||||
not_empty = ... # type: Any
|
||||
not_full = ... # type: Any
|
||||
all_tasks_done = ... # type: Any
|
||||
unfinished_tasks = ... # type: Any
|
||||
def __init__(self, maxsize: int = 0) -> None: ...
|
||||
def task_done(self) -> None: ...
|
||||
def join(self) -> None: ...
|
||||
def qsize(self) -> int: ...
|
||||
def empty(self) -> bool: ...
|
||||
def full(self) -> bool: ...
|
||||
def put(self, item: Any, block: bool = ..., timeout: float = None) -> None: ...
|
||||
def put_nowait(self, item) -> None: ...
|
||||
def get(self, block: bool = ..., timeout: float = None) -> Any: ...
|
||||
def get_nowait(self) -> Any: ...
|
||||
|
||||
class PriorityQueue(Queue): ...
|
||||
class LifoQueue(Queue): ...
|
||||
@@ -0,0 +1,28 @@
|
||||
# Stubs for StringIO (Python 2)
|
||||
|
||||
from typing import Any, IO, AnyStr, Iterator, Iterable, Generic
|
||||
|
||||
class StringIO(IO[AnyStr], Generic[AnyStr]):
|
||||
closed = ... # type: bool
|
||||
softspace = ... # type: int
|
||||
def __init__(self, buf: AnyStr = '') -> None: ...
|
||||
def __iter__(self) -> Iterator[AnyStr]: ...
|
||||
def next(self) -> AnyStr: ...
|
||||
def close(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def seek(self, pos: int, mode: int = 0) -> None: ...
|
||||
def tell(self) -> int: ...
|
||||
def read(self, n: int = -1) -> AnyStr: ...
|
||||
def readline(self, length: int = None) -> AnyStr: ...
|
||||
def readlines(self, sizehint: int = 0) -> List[AnyStr]: ...
|
||||
def truncate(self, size: int = None) -> int: ...
|
||||
def write(self, s: AnyStr) -> None: ...
|
||||
def writelines(self, iterable: Iterable[AnyStr]) -> None: ...
|
||||
def flush(self) -> None: ...
|
||||
def getvalue(self) -> AnyStr: ...
|
||||
def __enter__(self) -> Any: ...
|
||||
def __exit__(self, type: Any, value: Any, traceback: Any) -> Any: ...
|
||||
def fileno(self) -> int: ...
|
||||
def readable(self) -> bool: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
@@ -0,0 +1,11 @@
|
||||
from typing import Dict, Generic, Mapping, TypeVar
|
||||
|
||||
_KT = TypeVar('_KT')
|
||||
_VT = TypeVar('_VT')
|
||||
|
||||
class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
data = ... # type: Mapping[_KT, _VT]
|
||||
|
||||
def __init__(self, initialdata: Mapping[_KT, _VT] = None) -> None: ...
|
||||
|
||||
# TODO: DictMixin
|
||||
@@ -0,0 +1,9 @@
|
||||
class _Feature: ...
|
||||
|
||||
absolute_import = None # type: _Feature
|
||||
division = None # type: _Feature
|
||||
generators = None # type: _Feature
|
||||
nested_scopes = None # type: _Feature
|
||||
print_function = None # type: _Feature
|
||||
unicode_literals = None # type: _Feature
|
||||
with_statement = None # type: _Feature
|
||||
@@ -1,34 +0,0 @@
|
||||
"""Stub file for the '_hotshot' module."""
|
||||
# This is an autogenerated file. It serves as a starting point
|
||||
# for a more precise manual annotation of this module.
|
||||
# Feel free to edit the source below, but remove this header when you do.
|
||||
|
||||
from typing import Any, List, Tuple, Dict, Generic
|
||||
|
||||
def coverage(a: str) -> Any: ...
|
||||
|
||||
def logreader(a: str) -> LogReaderType:
|
||||
raise IOError()
|
||||
raise RuntimeError()
|
||||
|
||||
def profiler(a: str, *args, **kwargs) -> Any:
|
||||
raise IOError()
|
||||
|
||||
def resolution() -> tuple: ...
|
||||
|
||||
|
||||
class LogReaderType(object):
|
||||
def close(self) -> None: ...
|
||||
def fileno(self) -> int:
|
||||
raise ValueError()
|
||||
|
||||
class ProfilerType(object):
|
||||
def addinfo(self, a: str, b: str) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def fileno(self) -> int:
|
||||
raise ValueError()
|
||||
def runcall(self, *args, **kwargs) -> Any: ...
|
||||
def runcode(self, a, b, *args, **kwargs) -> Any:
|
||||
raise TypeError()
|
||||
def start(self) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
@@ -1,19 +0,0 @@
|
||||
"""Stub file for the '_json' module."""
|
||||
# This is an autogenerated file. It serves as a starting point
|
||||
# for a more precise manual annotation of this module.
|
||||
# Feel free to edit the source below, but remove this header when you do.
|
||||
|
||||
from typing import Any, List, Tuple, Dict, Generic
|
||||
|
||||
def encode_basestring_ascii(*args, **kwargs) -> str:
|
||||
raise TypeError()
|
||||
|
||||
def scanstring(a, b, *args, **kwargs) -> tuple:
|
||||
raise TypeError()
|
||||
|
||||
|
||||
class Encoder(object):
|
||||
pass
|
||||
|
||||
class Scanner(object):
|
||||
pass
|
||||
@@ -0,0 +1,5 @@
|
||||
# Stubs for abc.
|
||||
|
||||
# Thesee definitions have special processing in type checker.
|
||||
class ABCMeta: ...
|
||||
abstractmethod = object()
|
||||
@@ -0,0 +1,171 @@
|
||||
# Stubs for argparse (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Sequence
|
||||
|
||||
SUPPRESS = ... # type: Any
|
||||
OPTIONAL = ... # type: Any
|
||||
ZERO_OR_MORE = ... # type: Any
|
||||
ONE_OR_MORE = ... # type: Any
|
||||
PARSER = ... # type: Any
|
||||
REMAINDER = ... # type: Any
|
||||
|
||||
class _AttributeHolder: ...
|
||||
|
||||
class HelpFormatter:
|
||||
def __init__(self, prog, indent_increment=2, max_help_position=24, width=None): ...
|
||||
class _Section:
|
||||
formatter = ... # type: Any
|
||||
parent = ... # type: Any
|
||||
heading = ... # type: Any
|
||||
items = ... # type: Any
|
||||
def __init__(self, formatter, parent, heading=None): ...
|
||||
def format_help(self): ...
|
||||
def start_section(self, heading): ...
|
||||
def end_section(self): ...
|
||||
def add_text(self, text): ...
|
||||
def add_usage(self, usage, actions, groups, prefix=None): ...
|
||||
def add_argument(self, action): ...
|
||||
def add_arguments(self, actions): ...
|
||||
def format_help(self): ...
|
||||
|
||||
class RawDescriptionHelpFormatter(HelpFormatter): ...
|
||||
class RawTextHelpFormatter(RawDescriptionHelpFormatter): ...
|
||||
class ArgumentDefaultsHelpFormatter(HelpFormatter): ...
|
||||
|
||||
class ArgumentError(Exception):
|
||||
argument_name = ... # type: Any
|
||||
message = ... # type: Any
|
||||
def __init__(self, argument, message): ...
|
||||
|
||||
class ArgumentTypeError(Exception): ...
|
||||
|
||||
class Action(_AttributeHolder):
|
||||
option_strings = ... # type: Any
|
||||
dest = ... # type: Any
|
||||
nargs = ... # type: Any
|
||||
const = ... # type: Any
|
||||
default = ... # type: Any
|
||||
type = ... # type: Any
|
||||
choices = ... # type: Any
|
||||
required = ... # type: Any
|
||||
help = ... # type: Any
|
||||
metavar = ... # type: Any
|
||||
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None,
|
||||
choices=None, required=False, help=None, metavar=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _StoreAction(Action):
|
||||
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None,
|
||||
choices=None, required=False, help=None, metavar=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _StoreConstAction(Action):
|
||||
def __init__(self, option_strings, dest, const, default=None, required=False, help=None,
|
||||
metavar=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _StoreTrueAction(_StoreConstAction):
|
||||
def __init__(self, option_strings, dest, default=False, required=False, help=None): ...
|
||||
|
||||
class _StoreFalseAction(_StoreConstAction):
|
||||
def __init__(self, option_strings, dest, default=True, required=False, help=None): ...
|
||||
|
||||
class _AppendAction(Action):
|
||||
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None,
|
||||
choices=None, required=False, help=None, metavar=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _AppendConstAction(Action):
|
||||
def __init__(self, option_strings, dest, const, default=None, required=False, help=None,
|
||||
metavar=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _CountAction(Action):
|
||||
def __init__(self, option_strings, dest, default=None, required=False, help=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _HelpAction(Action):
|
||||
def __init__(self, option_strings, dest=..., default=..., help=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _VersionAction(Action):
|
||||
version = ... # type: Any
|
||||
def __init__(self, option_strings, version=None, dest=..., default=..., help=''): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _SubParsersAction(Action):
|
||||
class _ChoicesPseudoAction(Action):
|
||||
def __init__(self, name, help): ...
|
||||
def __init__(self, option_strings, prog, parser_class, dest=..., help=None, metavar=None): ...
|
||||
def add_parser(self, name, **kwargs): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class FileType:
|
||||
def __init__(self, mode='', bufsize=-1): ...
|
||||
def __call__(self, string): ...
|
||||
|
||||
class Namespace(_AttributeHolder):
|
||||
def __init__(self, **kwargs): ...
|
||||
__hash__ = ... # type: Any
|
||||
def __eq__(self, other): ...
|
||||
def __ne__(self, other): ...
|
||||
def __contains__(self, key): ...
|
||||
|
||||
class _ActionsContainer:
|
||||
description = ... # type: Any
|
||||
argument_default = ... # type: Any
|
||||
prefix_chars = ... # type: Any
|
||||
conflict_handler = ... # type: Any
|
||||
def __init__(self, description, prefix_chars, argument_default, conflict_handler): ...
|
||||
def register(self, registry_name, value, object): ...
|
||||
def set_defaults(self, **kwargs): ...
|
||||
def get_default(self, dest): ...
|
||||
def add_argument(self,
|
||||
*args: str,
|
||||
action: str = None,
|
||||
nargs: str = None,
|
||||
const: Any = None,
|
||||
default: Any = None,
|
||||
type: Any = None,
|
||||
choices: Any = None, # TODO: Container?
|
||||
required: bool = None,
|
||||
help: str = None,
|
||||
metavar: str = None,
|
||||
dest: str = None,
|
||||
) -> None: ...
|
||||
def add_argument_group(self, *args, **kwargs): ...
|
||||
def add_mutually_exclusive_group(self, **kwargs): ...
|
||||
|
||||
class _ArgumentGroup(_ActionsContainer):
|
||||
title = ... # type: Any
|
||||
def __init__(self, container, title=None, description=None, **kwargs): ...
|
||||
|
||||
class _MutuallyExclusiveGroup(_ArgumentGroup):
|
||||
required = ... # type: Any
|
||||
def __init__(self, container, required=False): ...
|
||||
|
||||
class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
prog = ... # type: Any
|
||||
usage = ... # type: Any
|
||||
epilog = ... # type: Any
|
||||
version = ... # type: Any
|
||||
formatter_class = ... # type: Any
|
||||
fromfile_prefix_chars = ... # type: Any
|
||||
add_help = ... # type: Any
|
||||
def __init__(self, prog=None, usage=None, description=None, epilog=None, version=None,
|
||||
parents=..., formatter_class=..., prefix_chars='', fromfile_prefix_chars=None,
|
||||
argument_default=None, conflict_handler='', add_help=True): ...
|
||||
def add_subparsers(self, **kwargs): ...
|
||||
def parse_args(self, args: Sequence[str] = None, namespace=None): ...
|
||||
def parse_known_args(self, args=None, namespace=None): ...
|
||||
def convert_arg_line_to_args(self, arg_line): ...
|
||||
def format_usage(self): ...
|
||||
def format_help(self): ...
|
||||
def format_version(self): ...
|
||||
def print_usage(self, file=None): ...
|
||||
def print_help(self, file=None): ...
|
||||
def print_version(self, file=None): ...
|
||||
def exit(self, status=0, message=None): ...
|
||||
def error(self, message): ...
|
||||
@@ -0,0 +1,5 @@
|
||||
from typing import TypeVar, Any
|
||||
|
||||
_FT = TypeVar('_FT')
|
||||
|
||||
def register(func: _FT, *args: Any, **kargs: Any) -> _FT: ...
|
||||
@@ -0,0 +1,25 @@
|
||||
# Stubs for base64
|
||||
|
||||
# Based on http://docs.python.org/3.2/library/base64.html
|
||||
|
||||
from typing import IO
|
||||
|
||||
def b64encode(s: str, altchars: str = None) -> str: ...
|
||||
def b64decode(s: str, altchars: str = None,
|
||||
validate: bool = False) -> str: ...
|
||||
def standard_b64encode(s: str) -> str: ...
|
||||
def standard_b64decode(s: str) -> str: ...
|
||||
def urlsafe_b64encode(s: str) -> str: ...
|
||||
def urlsafe_b64decode(s: str) -> str: ...
|
||||
def b32encode(s: str) -> str: ...
|
||||
def b32decode(s: str, casefold: bool = False,
|
||||
map01: str = None) -> str: ...
|
||||
def b16encode(s: str) -> str: ...
|
||||
def b16decode(s: str, casefold: bool = False) -> str: ...
|
||||
|
||||
def decode(input: IO[str], output: IO[str]) -> None: ...
|
||||
def decodebytes(s: str) -> str: ...
|
||||
def decodestring(s: str) -> str: ...
|
||||
def encode(input: IO[str], output: IO[str]) -> None: ...
|
||||
def encodebytes(s: str) -> str: ...
|
||||
def encodestring(s: str) -> str: ...
|
||||
@@ -0,0 +1,165 @@
|
||||
# Stubs for codecs (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
BOM_UTF8 = ... # type: Any
|
||||
BOM_LE = ... # type: Any
|
||||
BOM_BE = ... # type: Any
|
||||
BOM_UTF32_LE = ... # type: Any
|
||||
BOM_UTF32_BE = ... # type: Any
|
||||
BOM = ... # type: Any
|
||||
BOM_UTF32 = ... # type: Any
|
||||
BOM32_LE = ... # type: Any
|
||||
BOM32_BE = ... # type: Any
|
||||
BOM64_LE = ... # type: Any
|
||||
BOM64_BE = ... # type: Any
|
||||
|
||||
class CodecInfo(tuple):
|
||||
name = ... # type: Any
|
||||
encode = ... # type: Any
|
||||
decode = ... # type: Any
|
||||
incrementalencoder = ... # type: Any
|
||||
incrementaldecoder = ... # type: Any
|
||||
streamwriter = ... # type: Any
|
||||
streamreader = ... # type: Any
|
||||
def __new__(cls, encode, decode, streamreader=None, streamwriter=None, incrementalencoder=None, incrementaldecoder=None, name=None): ...
|
||||
|
||||
class Codec:
|
||||
def encode(self, input, errors=''): ...
|
||||
def decode(self, input, errors=''): ...
|
||||
|
||||
class IncrementalEncoder:
|
||||
errors = ... # type: Any
|
||||
buffer = ... # type: Any
|
||||
def __init__(self, errors=''): ...
|
||||
def encode(self, input, final=False): ...
|
||||
def reset(self): ...
|
||||
def getstate(self): ...
|
||||
def setstate(self, state): ...
|
||||
|
||||
class BufferedIncrementalEncoder(IncrementalEncoder):
|
||||
buffer = ... # type: Any
|
||||
def __init__(self, errors=''): ...
|
||||
def encode(self, input, final=False): ...
|
||||
def reset(self): ...
|
||||
def getstate(self): ...
|
||||
def setstate(self, state): ...
|
||||
|
||||
class IncrementalDecoder:
|
||||
errors = ... # type: Any
|
||||
def __init__(self, errors=''): ...
|
||||
def decode(self, input, final=False): ...
|
||||
def reset(self): ...
|
||||
def getstate(self): ...
|
||||
def setstate(self, state): ...
|
||||
|
||||
class BufferedIncrementalDecoder(IncrementalDecoder):
|
||||
buffer = ... # type: Any
|
||||
def __init__(self, errors=''): ...
|
||||
def decode(self, input, final=False): ...
|
||||
def reset(self): ...
|
||||
def getstate(self): ...
|
||||
def setstate(self, state): ...
|
||||
|
||||
class StreamWriter(Codec):
|
||||
stream = ... # type: Any
|
||||
errors = ... # type: Any
|
||||
def __init__(self, stream, errors=''): ...
|
||||
def write(self, object): ...
|
||||
def writelines(self, list): ...
|
||||
def reset(self): ...
|
||||
def seek(self, offset, whence=0): ...
|
||||
def __getattr__(self, name, getattr=...): ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, type, value, tb): ...
|
||||
|
||||
class StreamReader(Codec):
|
||||
stream = ... # type: Any
|
||||
errors = ... # type: Any
|
||||
bytebuffer = ... # type: Any
|
||||
charbuffer = ... # type: Any
|
||||
linebuffer = ... # type: Any
|
||||
def __init__(self, stream, errors=''): ...
|
||||
def decode(self, input, errors=''): ...
|
||||
def read(self, size=-1, chars=-1, firstline=False): ...
|
||||
def readline(self, size=None, keepends=True): ...
|
||||
def readlines(self, sizehint=None, keepends=True): ...
|
||||
def reset(self): ...
|
||||
def seek(self, offset, whence=0): ...
|
||||
def next(self): ...
|
||||
def __iter__(self): ...
|
||||
def __getattr__(self, name, getattr=...): ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, type, value, tb): ...
|
||||
|
||||
class StreamReaderWriter:
|
||||
encoding = ... # type: Any
|
||||
stream = ... # type: Any
|
||||
reader = ... # type: Any
|
||||
writer = ... # type: Any
|
||||
errors = ... # type: Any
|
||||
def __init__(self, stream, Reader, Writer, errors=''): ...
|
||||
def read(self, size=-1): ...
|
||||
def readline(self, size=None): ...
|
||||
def readlines(self, sizehint=None): ...
|
||||
def next(self): ...
|
||||
def __iter__(self): ...
|
||||
def write(self, data): ...
|
||||
def writelines(self, list): ...
|
||||
def reset(self): ...
|
||||
def seek(self, offset, whence=0): ...
|
||||
def __getattr__(self, name, getattr=...): ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, type, value, tb): ...
|
||||
|
||||
class StreamRecoder:
|
||||
data_encoding = ... # type: Any
|
||||
file_encoding = ... # type: Any
|
||||
stream = ... # type: Any
|
||||
encode = ... # type: Any
|
||||
decode = ... # type: Any
|
||||
reader = ... # type: Any
|
||||
writer = ... # type: Any
|
||||
errors = ... # type: Any
|
||||
def __init__(self, stream, encode, decode, Reader, Writer, errors=''): ...
|
||||
def read(self, size=-1): ...
|
||||
def readline(self, size=None): ...
|
||||
def readlines(self, sizehint=None): ...
|
||||
def next(self): ...
|
||||
def __iter__(self): ...
|
||||
def write(self, data): ...
|
||||
def writelines(self, list): ...
|
||||
def reset(self): ...
|
||||
def __getattr__(self, name, getattr=...): ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, type, value, tb): ...
|
||||
|
||||
def open(filename, mode='', encoding=None, errors='', buffering=1): ...
|
||||
def EncodedFile(file, data_encoding, file_encoding=None, errors=''): ...
|
||||
def getencoder(encoding): ...
|
||||
def getdecoder(encoding): ...
|
||||
def getincrementalencoder(encoding): ...
|
||||
def getincrementaldecoder(encoding): ...
|
||||
def getreader(encoding): ...
|
||||
def getwriter(encoding): ...
|
||||
def iterencode(iterator, encoding, errors='', **kwargs): ...
|
||||
def iterdecode(iterator, encoding, errors='', **kwargs): ...
|
||||
|
||||
strict_errors = ... # type: Any
|
||||
ignore_errors = ... # type: Any
|
||||
replace_errors = ... # type: Any
|
||||
xmlcharrefreplace_errors = ... # type: Any
|
||||
backslashreplace_errors = ... # type: Any
|
||||
|
||||
# Names in __all__ with no definition:
|
||||
# BOM_UTF16
|
||||
# BOM_UTF16_BE
|
||||
# BOM_UTF16_LE
|
||||
# decode
|
||||
# encode
|
||||
# lookup
|
||||
# lookup_error
|
||||
# register
|
||||
# register_error
|
||||
@@ -0,0 +1,96 @@
|
||||
# Stubs for collections
|
||||
|
||||
# Based on http://docs.python.org/2.7/library/collections.html
|
||||
|
||||
# TODO UserDict
|
||||
# TODO UserList
|
||||
# TODO UserString
|
||||
# TODO more abstract base classes (interfaces in mypy)
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import (
|
||||
Dict, Generic, TypeVar, Iterable, Tuple, Callable, Mapping, overload, Iterator, Sized,
|
||||
Optional, List, Set, Sequence, Union, Reversible
|
||||
)
|
||||
import typing
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_KT = TypeVar('_KT')
|
||||
_VT = TypeVar('_VT')
|
||||
|
||||
# namedtuple is special-cased in the type checker; the initializer is ignored.
|
||||
namedtuple = object()
|
||||
|
||||
MutableMapping = typing.MutableMapping
|
||||
|
||||
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = None,
|
||||
maxlen: int = None) -> None: ...
|
||||
@property
|
||||
def maxlen(self) -> Optional[int]: ...
|
||||
def append(self, x: _T) -> None: ...
|
||||
def appendleft(self, x: _T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def count(self, x: _T) -> int: ...
|
||||
def extend(self, iterable: Iterable[_T]) -> None: ...
|
||||
def extendleft(self, iterable: Iterable[_T]) -> None: ...
|
||||
def pop(self) -> _T: ...
|
||||
def popleft(self) -> _T: ...
|
||||
def remove(self, value: _T) -> None: ...
|
||||
def reverse(self) -> None: ...
|
||||
def rotate(self, n: int) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
def __setitem__(self, i: int, x: _T) -> None: ...
|
||||
def __contains__(self, o: _T) -> bool: ...
|
||||
def __reversed__(self) -> Iterator[_T]: ...
|
||||
|
||||
class Counter(Dict[_T, int], Generic[_T]):
|
||||
# TODO: __init__ keyword arguments
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, Mapping: Mapping[_T, int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
def elements(self) -> Iterator[_T]: ...
|
||||
def most_common(self, n: int = ...) -> List[_T]: ...
|
||||
@overload
|
||||
def subtract(self, mapping: Mapping[_T, int]) -> None: ...
|
||||
@overload
|
||||
def subtract(self, iterable: Iterable[_T]) -> None: ...
|
||||
# The Iterable[Tuple[...]] argument type is not actually desirable
|
||||
# (the tuples will be added as keys, breaking type safety) but
|
||||
# it's included so that the signature is compatible with
|
||||
# Dict.update. Not sure if we should use '# type: ignore' instead
|
||||
# and omit the type from the union.
|
||||
def update(self, m: Union[Mapping[_T, int],
|
||||
Iterable[Tuple[_T, int]],
|
||||
Iterable[_T]]) -> None: ...
|
||||
|
||||
class OrderedDict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
def popitem(self, last: bool = True) -> Tuple[_KT, _VT]: ...
|
||||
def move_to_end(self, key: _KT, last: bool = True) -> None: ...
|
||||
|
||||
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
default_factory = ... # type: Callable[[], _VT]
|
||||
# TODO: __init__ keyword args
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, map: Mapping[_KT, _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Callable[[], _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Callable[[], _VT],
|
||||
map: Mapping[_KT, _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Callable[[], _VT],
|
||||
iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
|
||||
def __missing__(self, key: _KT) -> _VT: ...
|
||||
@@ -0,0 +1,7 @@
|
||||
# Stubs for compileall (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None, quiet=0): ...
|
||||
def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0): ...
|
||||
def compile_path(skip_curdir=1, maxlevels=0, force=0, quiet=0): ...
|
||||
@@ -0,0 +1,8 @@
|
||||
# Stubs for contextlib
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import Any
|
||||
|
||||
# TODO more precise type?
|
||||
def contextmanager(func: Any) -> Any: ...
|
||||
@@ -0,0 +1,10 @@
|
||||
# Stubs for copy
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import TypeVar
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
def deepcopy(x: _T) -> _T: ...
|
||||
def copy(x: _T) -> _T: ...
|
||||
@@ -0,0 +1,93 @@
|
||||
# Stubs for csv (Python 2.7)
|
||||
#
|
||||
# NOTE: Based on a dynamically typed stub automatically generated by stubgen.
|
||||
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Any, Dict, Iterable, List, Sequence, Union
|
||||
|
||||
# Public interface of _csv.reader
|
||||
class Reader(Iterable[List[str]], metaclass=ABCMeta):
|
||||
dialect = ... # type: Dialect
|
||||
line_num = ... # type: int
|
||||
|
||||
@abstractmethod
|
||||
def next(self) -> List[str]: ...
|
||||
|
||||
_Row = Sequence[Union[str, int]]
|
||||
|
||||
# Public interface of _csv.writer
|
||||
class Writer(metaclass=ABCMeta):
|
||||
dialect = ... # type: Dialect
|
||||
|
||||
@abstractmethod
|
||||
def writerow(self, row: _Row) -> None: ...
|
||||
|
||||
@abstractmethod
|
||||
def writerows(self, rows: Iterable[_Row]) -> None: ...
|
||||
|
||||
QUOTE_ALL = ... # type: int
|
||||
QUOTE_MINIMAL = ... # type: int
|
||||
QUOTE_NONE = ... # type: int
|
||||
QUOTE_NONNUMERIC = ... # type: int
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
_Dialect = Union[str, Dialect]
|
||||
|
||||
def writer(csvfile: Any, dialect: _Dialect = ..., **fmtparams) -> Writer: ...
|
||||
def reader(csvfile: Iterable[str], dialect: _Dialect = ..., **fmtparams) -> Reader: ...
|
||||
def register_dialect(name, dialect=..., **fmtparams): ...
|
||||
def unregister_dialect(name): ...
|
||||
def get_dialect(name: str) -> Dialect: ...
|
||||
def list_dialects(): ...
|
||||
def field_size_limit(new_limit: int = ...) -> int: ...
|
||||
|
||||
class Dialect:
|
||||
delimiter = ... # type: str
|
||||
quotechar = ... # type: str
|
||||
escapechar = ... # type: str
|
||||
doublequote = ... # type: bool
|
||||
skipinitialspace = ... # type: bool
|
||||
lineterminator = ... # type: str
|
||||
quoting = ... # type: int
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class excel(Dialect):
|
||||
pass
|
||||
|
||||
class excel_tab(excel):
|
||||
pass
|
||||
|
||||
class unix_dialect(Dialect):
|
||||
pass
|
||||
|
||||
class DictReader:
|
||||
restkey = ... # type: Any
|
||||
restval = ... # type: Any
|
||||
reader = ... # type: Any
|
||||
dialect = ... # type: _Dialect
|
||||
line_num = ... # type: int
|
||||
fieldnames = ... # type: Sequence[Any]
|
||||
def __init__(self, f: Iterable[str], fieldnames: Sequence[Any] = None, restkey=None,
|
||||
restval=None, dialect: _Dialect = '', *args, **kwds) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __next__(self): ...
|
||||
|
||||
_DictRow = Dict[Any, Union[str, int]]
|
||||
|
||||
class DictWriter:
|
||||
fieldnames = ... # type: Any
|
||||
restval = ... # type: Any
|
||||
extrasaction = ... # type: Any
|
||||
writer = ... # type: Any
|
||||
def __init__(self, f: Any, fieldnames: Sequence[Any], restval='', extrasaction: str = ...,
|
||||
dialect: _Dialect = '', *args, **kwds) -> None: ...
|
||||
def writeheader(self) -> None: ...
|
||||
def writerow(self, rowdict: _DictRow) -> None: ...
|
||||
def writerows(self, rowdicts: Iterable[_DictRow]) -> None: ...
|
||||
|
||||
class Sniffer:
|
||||
preferred = ... # type: Any
|
||||
def __init__(self) -> None: ...
|
||||
def sniff(self, sample: str, delimiters: str = None) -> Dialect: ...
|
||||
def has_header(self, sample: str) -> bool: ...
|
||||
@@ -1,221 +0,0 @@
|
||||
# Stubs for datetime
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import Optional, SupportsAbs, Tuple, Union, overload
|
||||
|
||||
MINYEAR = 0
|
||||
MAXYEAR = 0
|
||||
|
||||
class tzinfo(object):
|
||||
def tzname(self, dt: Optional[datetime]) -> str: ...
|
||||
def utcoffset(self, dt: Optional[datetime]) -> int: ...
|
||||
def dst(self, dt: Optional[datetime]) -> int: ...
|
||||
def fromutc(self, dt: datetime) -> datetime: ...
|
||||
|
||||
class timezone(tzinfo):
|
||||
utc = ... # type: tzinfo
|
||||
min = ... # type: tzinfo
|
||||
max = ... # type: tzinfo
|
||||
|
||||
def __init__(self, offset: timedelta, name: str = '') -> None: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
_tzinfo = tzinfo
|
||||
_timezone = timezone
|
||||
|
||||
class date(object):
|
||||
min = ... # type: date
|
||||
max = ... # type: date
|
||||
resolution = ... # type: timedelta
|
||||
|
||||
def __init__(self, year: int, month: int = None, day: int = None) -> None: ...
|
||||
|
||||
@classmethod
|
||||
def fromtimestamp(cls, t: float) -> date: ...
|
||||
@classmethod
|
||||
def today(cls) -> date: ...
|
||||
@classmethod
|
||||
def fromordinal(cls, n: int) -> date: ...
|
||||
|
||||
@property
|
||||
def year(self) -> int: ...
|
||||
@property
|
||||
def month(self) -> int: ...
|
||||
@property
|
||||
def day(self) -> int: ...
|
||||
|
||||
def ctime(self) -> str: ...
|
||||
def strftime(self, fmt: str) -> str: ...
|
||||
def __format__(self, fmt: Union[str, unicode]) -> str: ...
|
||||
def isoformat(self) -> str: ...
|
||||
def timetuple(self) -> tuple: ... # TODO return type
|
||||
def toordinal(self) -> int: ...
|
||||
def replace(self, year: int = None, month: int = None, day: int = None) -> date: ...
|
||||
def __le__(self, other: date) -> bool: ...
|
||||
def __lt__(self, other: date) -> bool: ...
|
||||
def __ge__(self, other: date) -> bool: ...
|
||||
def __gt__(self, other: date) -> bool: ...
|
||||
def __add__(self, other: timedelta) -> date: ...
|
||||
@overload
|
||||
def __sub__(self, other: timedelta) -> date: ...
|
||||
@overload
|
||||
def __sub__(self, other: date) -> timedelta: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def weekday(self) -> int: ...
|
||||
def isoweekday(self) -> int: ...
|
||||
def isocalendar(self) -> Tuple[int, int, int]: ...
|
||||
|
||||
class time:
|
||||
min = ... # type: time
|
||||
max = ... # type: time
|
||||
resolution = ... # type: timedelta
|
||||
|
||||
def __init__(self, hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0,
|
||||
tzinfo: tzinfo = None) -> None: ...
|
||||
|
||||
@property
|
||||
def hour(self) -> int: ...
|
||||
@property
|
||||
def minute(self) -> int: ...
|
||||
@property
|
||||
def second(self) -> int: ...
|
||||
@property
|
||||
def microsecond(self) -> int: ...
|
||||
@property
|
||||
def tzinfo(self) -> _tzinfo: ...
|
||||
|
||||
def __le__(self, other: time) -> bool: ...
|
||||
def __lt__(self, other: time) -> bool: ...
|
||||
def __ge__(self, other: time) -> bool: ...
|
||||
def __gt__(self, other: time) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def isoformat(self) -> str: ...
|
||||
def strftime(self, fmt: str) -> str: ...
|
||||
def __format__(self, fmt: str) -> str: ...
|
||||
def utcoffset(self) -> Optional[int]: ...
|
||||
def tzname(self) -> Optional[str]: ...
|
||||
def dst(self) -> Optional[int]: ...
|
||||
def replace(self, hour: int = None, minute: int = None, second: int = None,
|
||||
microsecond: int = None, tzinfo: Union[_tzinfo, bool] = True) -> time: ...
|
||||
|
||||
_date = date
|
||||
_time = time
|
||||
|
||||
class timedelta(SupportsAbs[timedelta]):
|
||||
min = ... # type: timedelta
|
||||
max = ... # type: timedelta
|
||||
resolution = ... # type: timedelta
|
||||
|
||||
def __init__(self, days: int = 0, seconds: int = 0, microseconds: int = 0,
|
||||
milliseconds: int = 0, minutes: int = 0, hours: int = 0,
|
||||
weeks: int = 0) -> None: ...
|
||||
|
||||
@property
|
||||
def days(self) -> int: ...
|
||||
@property
|
||||
def seconds(self) -> int: ...
|
||||
@property
|
||||
def microseconds(self) -> int: ...
|
||||
|
||||
def total_seconds(self) -> float: ...
|
||||
def __add__(self, other: timedelta) -> timedelta: ...
|
||||
def __radd__(self, other: timedelta) -> timedelta: ...
|
||||
def __sub__(self, other: timedelta) -> timedelta: ...
|
||||
def __rsub(self, other: timedelta) -> timedelta: ...
|
||||
def __neg__(self) -> timedelta: ...
|
||||
def __pos__(self) -> timedelta: ...
|
||||
def __abs__(self) -> timedelta: ...
|
||||
def __mul__(self, other: float) -> timedelta: ...
|
||||
def __rmul__(self, other: float) -> timedelta: ...
|
||||
@overload
|
||||
def __floordiv__(self, other: timedelta) -> int: ...
|
||||
@overload
|
||||
def __floordiv__(self, other: int) -> timedelta: ...
|
||||
@overload
|
||||
def __truediv__(self, other: timedelta) -> float: ...
|
||||
@overload
|
||||
def __truediv__(self, other: float) -> timedelta: ...
|
||||
def __mod__(self, other: timedelta) -> timedelta: ...
|
||||
def __divmod__(self, other: timedelta) -> Tuple[int, timedelta]: ...
|
||||
def __le__(self, other: timedelta) -> bool: ...
|
||||
def __lt__(self, other: timedelta) -> bool: ...
|
||||
def __ge__(self, other: timedelta) -> bool: ...
|
||||
def __gt__(self, other: timedelta) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class datetime(object):
|
||||
# TODO: is actually subclass of date, but __le__, __lt__, __ge__, __gt__ don't work with date.
|
||||
min = ... # type: datetime
|
||||
max = ... # type: datetime
|
||||
resolution = ... # type: timedelta
|
||||
|
||||
def __init__(self, year: int, month: int = None, day: int = None, hour: int = None,
|
||||
minute: int = None, second: int = None, microseconds: int = None,
|
||||
tzinfo: tzinfo = None) -> None: ...
|
||||
|
||||
@property
|
||||
def year(self) -> int: ...
|
||||
@property
|
||||
def month(self) -> int: ...
|
||||
@property
|
||||
def day(self) -> int: ...
|
||||
@property
|
||||
def hour(self) -> int: ...
|
||||
@property
|
||||
def minute(self) -> int: ...
|
||||
@property
|
||||
def second(self) -> int: ...
|
||||
@property
|
||||
def microsecond(self) -> int: ...
|
||||
@property
|
||||
def tzinfo(self) -> _tzinfo: ...
|
||||
|
||||
@classmethod
|
||||
def fromtimestamp(cls, t: float, tz: timezone = None) -> datetime: ...
|
||||
@classmethod
|
||||
def utcfromtimestamp(cls, t: float) -> datetime: ...
|
||||
@classmethod
|
||||
def today(cls) -> datetime: ...
|
||||
@classmethod
|
||||
def fromordinal(cls, n: int) -> datetime: ...
|
||||
@classmethod
|
||||
def now(cls, tz: timezone = None) -> datetime: ...
|
||||
@classmethod
|
||||
def utcnow(cls) -> datetime: ...
|
||||
@classmethod
|
||||
def combine(cls, date: date, time: time) -> datetime: ...
|
||||
def strftime(self, fmt: str) -> str: ...
|
||||
def __format__(self, fmt: str) -> str: ...
|
||||
def toordinal(self) -> int: ...
|
||||
def timetuple(self) -> tuple: ... # TODO return type
|
||||
def timestamp(self) -> float: ...
|
||||
def utctimetuple(self) -> tuple: # TODO return type
|
||||
raise OverflowError()
|
||||
def date(self) -> _date: ...
|
||||
def time(self) -> _time: ...
|
||||
def timetz(self) -> _time: ...
|
||||
def replace(self, year: int = None, month: int = None, day: int = None, hour: int = None,
|
||||
minute: int = None, second: int = None, microsecond: int = None, tzinfo:
|
||||
Union[_tzinfo, bool] = True) -> datetime: ...
|
||||
def astimezone(self, tz: timezone = None) -> datetime: ...
|
||||
def ctime(self) -> str: ...
|
||||
def isoformat(self, sep: str = 'T') -> str: ...
|
||||
@classmethod
|
||||
def strptime(cls, date_string: str, format: str) -> datetime: ...
|
||||
def utcoffset(self) -> Optional[int]: ...
|
||||
def tzname(self) -> Optional[str]: ...
|
||||
def dst(self) -> Optional[int]: ...
|
||||
def __le__(self, other: datetime) -> bool: ...
|
||||
def __lt__(self, other: datetime) -> bool: ...
|
||||
def __ge__(self, other: datetime) -> bool: ...
|
||||
def __gt__(self, other: datetime) -> bool: ...
|
||||
def __add__(self, other: timedelta) -> datetime: ...
|
||||
@overload
|
||||
def __sub__(self, other: datetime) -> timedelta: ...
|
||||
@overload
|
||||
def __sub__(self, other: timedelta) -> datetime: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def weekday(self) -> int: ...
|
||||
def isoweekday(self) -> int: ...
|
||||
def isocalendar(self) -> Tuple[int, int, int]: ...
|
||||
@@ -0,0 +1,63 @@
|
||||
# Stubs for difflib
|
||||
|
||||
# Based on https://docs.python.org/2.7/library/difflib.html
|
||||
|
||||
# TODO: Support unicode?
|
||||
|
||||
from typing import (
|
||||
TypeVar, Callable, Iterable, List, NamedTuple, Sequence, Tuple, Generic
|
||||
)
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class SequenceMatcher(Generic[_T]):
|
||||
def __init__(self, isjunk: Callable[[_T], bool] = None,
|
||||
a: Sequence[_T] = None, b: Sequence[_T] = None,
|
||||
autojunk: bool = True) -> None: ...
|
||||
def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ...
|
||||
def set_seq1(self, a: Sequence[_T]) -> None: ...
|
||||
def set_seq2(self, b: Sequence[_T]) -> None: ...
|
||||
def find_longest_match(self, alo: int, ahi: int, blo: int,
|
||||
bhi: int) -> Tuple[int, int, int]: ...
|
||||
def get_matching_blocks(self) -> List[Tuple[int, int, int]]: ...
|
||||
def get_opcodes(self) -> List[Tuple[str, int, int, int, int]]: ...
|
||||
def get_grouped_opcodes(self, n: int = 3
|
||||
) -> Iterable[Tuple[str, int, int, int, int]]: ...
|
||||
def ratio(self) -> float: ...
|
||||
def quick_ratio(self) -> float: ...
|
||||
def real_quick_ratio(self) -> float: ...
|
||||
|
||||
def get_close_matches(word: Sequence[_T], possibilities: List[Sequence[_T]],
|
||||
n: int = 3, cutoff: float = 0.6) -> List[Sequence[_T]]: ...
|
||||
|
||||
class Differ:
|
||||
def __init__(self, linejunk: Callable[[str], bool] = None,
|
||||
charjunk: Callable[[str], bool] = None) -> None: ...
|
||||
def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterable[str]: ...
|
||||
|
||||
def IS_LINE_JUNK(str) -> bool: ...
|
||||
def IS_CHARACTER_JUNK(str) -> bool: ...
|
||||
def unified_diff(a: Sequence[str], b: Sequence[str], fromfile: str = '',
|
||||
tofile: str = '', fromfiledate: str = '', tofiledate: str = '',
|
||||
n: int = 3, lineterm: str = '\n') -> Iterable[str]: ...
|
||||
def context_diff(a: Sequence[str], b: Sequence[str], fromfile: str='',
|
||||
tofile: str = '', fromfiledate: str = '', tofiledate: str = '',
|
||||
n: int = 3, lineterm: str = '\n') -> Iterable[str]: ...
|
||||
def ndiff(a: Sequence[str], b: Sequence[str],
|
||||
linejunk: Callable[[str], bool] = None,
|
||||
charjunk: Callable[[str], bool] = IS_CHARACTER_JUNK
|
||||
) -> Iterable[str]: ...
|
||||
|
||||
class HtmlDiff(object):
|
||||
def __init__(self, tabsize: int = 8, wrapcolumn: int = None,
|
||||
linejunk: Callable[[str], bool] = None,
|
||||
charjunk: Callable[[str], bool] = IS_CHARACTER_JUNK
|
||||
) -> None: ...
|
||||
def make_file(self, fromlines: Sequence[str], tolines: Sequence[str],
|
||||
fromdesc: str = '', todesc: str = '', context: bool = False,
|
||||
numlines: int = 5) -> str: ...
|
||||
def make_table(self, fromlines: Sequence[str], tolines: Sequence[str],
|
||||
fromdesc: str = '', todesc: str = '', context: bool = False,
|
||||
numlines: int = 5) -> str: ...
|
||||
|
||||
def restore(delta: Iterable[str], which: int) -> Iterable[int]: ...
|
||||
@@ -0,0 +1,7 @@
|
||||
# Stubs for distutils (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
__revision__ = ... # type: Any
|
||||
@@ -0,0 +1,23 @@
|
||||
# Stubs for distutils.version (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class Version:
|
||||
def __init__(self, vstring=None): ...
|
||||
|
||||
class StrictVersion(Version):
|
||||
version_re = ... # type: Any
|
||||
version = ... # type: Any
|
||||
prerelease = ... # type: Any
|
||||
def parse(self, vstring): ...
|
||||
def __cmp__(self, other): ...
|
||||
|
||||
class LooseVersion(Version):
|
||||
component_re = ... # type: Any
|
||||
def __init__(self, vstring=None): ...
|
||||
vstring = ... # type: Any
|
||||
version = ... # type: Any
|
||||
def parse(self, vstring): ...
|
||||
def __cmp__(self, other): ...
|
||||
@@ -0,0 +1,8 @@
|
||||
# Stubs for email.MIMEText (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
|
||||
class MIMEText(MIMENonMultipart):
|
||||
def __init__(self, _text, _subtype='', _charset=''): ...
|
||||
@@ -0,0 +1,10 @@
|
||||
# Stubs for email.mime.base (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
# import message
|
||||
|
||||
# TODO
|
||||
#class MIMEBase(message.Message):
|
||||
class MIMEBase:
|
||||
def __init__(self, _maintype, _subtype, **_params): ...
|
||||
@@ -0,0 +1,8 @@
|
||||
# Stubs for email.mime.multipart (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from email.mime.base import MIMEBase
|
||||
|
||||
class MIMEMultipart(MIMEBase):
|
||||
def __init__(self, _subtype='', boundary=None, _subparts=None, **_params): ...
|
||||
@@ -0,0 +1,8 @@
|
||||
# Stubs for email.mime.nonmultipart (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from email.mime.base import MIMEBase
|
||||
|
||||
class MIMENonMultipart(MIMEBase):
|
||||
def attach(self, payload): ...
|
||||
@@ -0,0 +1,8 @@
|
||||
# Stubs for email.mime.text (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
|
||||
class MIMEText(MIMENonMultipart):
|
||||
def __init__(self, _text, _subtype='', _charset=''): ...
|
||||
@@ -0,0 +1,6 @@
|
||||
from typing import Iterable, Pattern
|
||||
|
||||
def fnmatch(filename: str, pattern: str) -> bool: ...
|
||||
def fnmatchcase(filename: str, pattern: str) -> bool: ...
|
||||
def filter(names: Iterable[str], pattern: str) -> Iterable[str]: ...
|
||||
def translate(pattern: str) -> Pattern[str]: ...
|
||||
@@ -0,0 +1,23 @@
|
||||
# Stubs for functools (Python 2.7)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Any, Callable, Dict, Sequence
|
||||
from collections import namedtuple
|
||||
|
||||
_AnyCallable = Callable[..., Any]
|
||||
|
||||
def reduce(function, iterable, initializer=None): ...
|
||||
|
||||
WRAPPER_ASSIGNMENTS = ... # type: Sequence[str]
|
||||
WRAPPER_UPDATES = ... # type: Sequence[str]
|
||||
|
||||
def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ...,
|
||||
updated: Sequence[str] = ...) -> None: ...
|
||||
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...
|
||||
def total_ordering(cls: type) -> type: ...
|
||||
def cmp_to_key(mycmp): ...
|
||||
|
||||
# TODO: give a more specific return type for partial (a callable object with some attributes).
|
||||
def partial(func: _AnyCallable, *args, **keywords) -> Any: ...
|
||||
@@ -0,0 +1,8 @@
|
||||
# Stubs for getpass (Python 2)
|
||||
|
||||
from typing import Any, IO
|
||||
|
||||
class GetPassWarning(UserWarning): ...
|
||||
|
||||
def getpass(prompt: str = 'Password: ', stream: IO[Any] = None) -> str: ...
|
||||
def getuser() -> str: ...
|
||||
@@ -0,0 +1,40 @@
|
||||
# TODO(MichalPokorny): better types
|
||||
|
||||
from typing import Any, IO, Optional, Union
|
||||
|
||||
def bindtextdomain(domain: str, localedir: str = None) -> str: ...
|
||||
def bind_textdomain_codeset(domain: str, codeset: str = None) -> str: ...
|
||||
def textdomain(domain: str = None) -> str: ...
|
||||
def gettext(message: str) -> str: ...
|
||||
def lgettext(message: str) -> str: ...
|
||||
def dgettext(domain: str, message: str) -> str: ...
|
||||
def ldgettext(domain: str, message: str) -> str: ...
|
||||
def ngettext(singular: str, plural: str, n: int) -> str: ...
|
||||
def lngettext(singular: str, plural: str, n: int) -> str: ...
|
||||
def dngettext(domain: str, singular: str, plural: str, n: int) -> str: ...
|
||||
def ldngettext(domain: str, singular: str, plural: str, n: int) -> str: ...
|
||||
|
||||
class Translations(object):
|
||||
def _parse(self, fp: IO[str]) -> None: ...
|
||||
def add_fallback(self, fallback: Any) -> None: ...
|
||||
def gettext(self, message: str) -> str: ...
|
||||
def lgettext(self, message: str) -> str: ...
|
||||
def ugettext(self, message: str) -> unicode: ...
|
||||
def ngettext(self, singular: str, plural: str, n: int) -> str: ...
|
||||
def lngettext(self, singular: str, plural: str, n: int) -> str: ...
|
||||
def ungettext(self, singular: str, plural: str, n: int) -> str: ...
|
||||
def info(self) -> Any: ...
|
||||
def charset(self) -> Any: ...
|
||||
def output_charset(self) -> Any: ...
|
||||
def set_output_charset(self, charset: Any) -> None: ...
|
||||
def install(self, unicode: bool = None, names: Any = None) -> None: ...
|
||||
|
||||
# TODO: NullTranslations, GNUTranslations
|
||||
|
||||
def find(domain: str, localedir: str = None, languages: List[str] = None,
|
||||
all: Any = None) -> Optional[Union[str, List[str]]]: ...
|
||||
|
||||
def translation(domain: str, localedir: str = None, languages: List[str] = None,
|
||||
class_: Any = None, fallback: Any = None, codeset: Any = None) -> Translations: ...
|
||||
def install(domain: str, localedir: str = None, unicode: Any = None, codeset: Any = None,
|
||||
names: Any = None) -> None: ...
|
||||
@@ -0,0 +1,4 @@
|
||||
from typing import List, Iterator, AnyStr
|
||||
|
||||
def glob(pathname: AnyStr) -> List[AnyStr]: ...
|
||||
def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ...
|
||||
@@ -0,0 +1,41 @@
|
||||
# Stubs for gzip (Python 2)
|
||||
#
|
||||
# NOTE: Based on a dynamically typed stub automatically generated by stubgen.
|
||||
|
||||
from typing import Any, IO
|
||||
import io
|
||||
|
||||
class GzipFile(io.BufferedIOBase):
|
||||
myfileobj = ... # type: Any
|
||||
max_read_chunk = ... # type: Any
|
||||
mode = ... # type: Any
|
||||
extrabuf = ... # type: Any
|
||||
extrasize = ... # type: Any
|
||||
extrastart = ... # type: Any
|
||||
name = ... # type: Any
|
||||
min_readsize = ... # type: Any
|
||||
compress = ... # type: Any
|
||||
fileobj = ... # type: Any
|
||||
offset = ... # type: Any
|
||||
mtime = ... # type: Any
|
||||
def __init__(self, filename: str = None, mode: str = None, compresslevel: int = 9,
|
||||
fileobj: IO[str] = None, mtime: float = None) -> None: ...
|
||||
@property
|
||||
def filename(self): ...
|
||||
size = ... # type: Any
|
||||
crc = ... # type: Any
|
||||
def write(self, data): ...
|
||||
def read(self, size=-1): ...
|
||||
@property
|
||||
def closed(self): ...
|
||||
def close(self): ...
|
||||
def flush(self, zlib_mode=...): ...
|
||||
def fileno(self): ...
|
||||
def rewind(self): ...
|
||||
def readable(self): ...
|
||||
def writable(self): ...
|
||||
def seekable(self): ...
|
||||
def seek(self, offset, whence=0): ...
|
||||
def readline(self, size=-1): ...
|
||||
|
||||
def open(filename: str, mode: str = '', compresslevel: int = ...) -> GzipFile: ...
|
||||
@@ -0,0 +1,27 @@
|
||||
# Stubs for hashlib (Python 2)
|
||||
|
||||
from typing import Tuple
|
||||
|
||||
class _hash(object):
|
||||
# This is not actually in the module namespace.
|
||||
digest_size = 0
|
||||
block_size = 0
|
||||
def update(self, arg: str) -> None: ...
|
||||
def digest(self) -> str: ...
|
||||
def hexdigest(self) -> str: ...
|
||||
def copy(self) -> _hash: ...
|
||||
|
||||
def new(algo: str = None) -> _hash: ...
|
||||
|
||||
def md5(s: str = None) -> _hash: ...
|
||||
def sha1(s: str = None) -> _hash: ...
|
||||
def sha224(s: str = None) -> _hash: ...
|
||||
def sha256(s: str = None) -> _hash: ...
|
||||
def sha384(s: str = None) -> _hash: ...
|
||||
def sha512(s: str = None) -> _hash: ...
|
||||
|
||||
algorithms = ... # type: Tuple[str, ...]
|
||||
algorithms_guaranteed = ... # type: Tuple[str, ...]
|
||||
algorithms_available = ... # type: Tuple[str, ...]
|
||||
|
||||
def pbkdf2_hmac(name: str, password: str, salt: str, rounds: int, dklen: int = None) -> str: ...
|
||||
@@ -0,0 +1,11 @@
|
||||
# Stubs for hmac (Python 2)
|
||||
|
||||
from typing import Any
|
||||
|
||||
class HMAC:
|
||||
def update(self, msg: str) -> None: ...
|
||||
def digest(self) -> str: ...
|
||||
def hexdigest(self) -> str: ...
|
||||
def copy(self) -> HMAC: ...
|
||||
|
||||
def new(key: str, msg: str = None, digestmod: Any = None) -> HMAC: ...
|
||||
@@ -0,0 +1,9 @@
|
||||
# Stubs for htmlentitydefs (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Mapping
|
||||
|
||||
name2codepoint = ... # type: Mapping[str, int]
|
||||
codepoint2name = ... # type: Mapping[int, str]
|
||||
entitydefs = ... # type: Mapping[str, str]
|
||||
@@ -0,0 +1,3 @@
|
||||
import types
|
||||
|
||||
def import_module(name: str, package: str = None) -> types.ModuleType: ...
|
||||
@@ -0,0 +1,11 @@
|
||||
# TODO incomplete
|
||||
from typing import Any, List, Tuple
|
||||
|
||||
def isgenerator(object: Any) -> bool: ...
|
||||
|
||||
class _Frame:
|
||||
...
|
||||
_FrameRecord = Tuple[_Frame, str, int, str, List[str], int]
|
||||
|
||||
def currentframe() -> _FrameRecord: ...
|
||||
def stack(context: int = None) -> List[_FrameRecord]: ...
|
||||
@@ -0,0 +1,101 @@
|
||||
# Stubs for io
|
||||
|
||||
# Based on https://docs.python.org/2/library/io.html
|
||||
|
||||
# Only a subset of functionality is included.
|
||||
|
||||
DEFAULT_BUFFER_SIZE = 0
|
||||
|
||||
from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Any, Union
|
||||
|
||||
def open(file: Union[str, unicode, int],
|
||||
mode: unicode = 'r', buffering: int = -1, encoding: unicode = None,
|
||||
errors: unicode = None, newline: unicode = None,
|
||||
closefd: bool = True) -> IO[Any]: ...
|
||||
|
||||
class IOBase:
|
||||
# TODO
|
||||
...
|
||||
|
||||
class BytesIO(BinaryIO):
|
||||
def __init__(self, initial_bytes: str = b'') -> None: ...
|
||||
# TODO getbuffer
|
||||
# TODO see comments in BinaryIO for missing functionality
|
||||
def close(self) -> None: ...
|
||||
def closed(self) -> bool: ...
|
||||
def fileno(self) -> int: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def read(self, n: int = -1) -> str: ...
|
||||
def readable(self) -> bool: ...
|
||||
def readline(self, limit: int = -1) -> str: ...
|
||||
def readlines(self, hint: int = -1) -> List[str]: ...
|
||||
def seek(self, offset: int, whence: int = 0) -> None: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def tell(self) -> int: ...
|
||||
def truncate(self, size: int = None) -> int: ...
|
||||
def writable(self) -> bool: ...
|
||||
def write(self, s: str) -> None: ...
|
||||
def writelines(self, lines: Iterable[str]) -> None: ...
|
||||
def getvalue(self) -> str: ...
|
||||
def read1(self) -> str: ...
|
||||
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __enter__(self) -> 'BytesIO': ...
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
|
||||
class StringIO(TextIO):
|
||||
def __init__(self, initial_value: unicode = '',
|
||||
newline: unicode = None) -> None: ...
|
||||
# TODO see comments in BinaryIO for missing functionality
|
||||
def close(self) -> None: ...
|
||||
def closed(self) -> bool: ...
|
||||
def fileno(self) -> int: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def read(self, n: int = -1) -> unicode: ...
|
||||
def readable(self) -> bool: ...
|
||||
def readline(self, limit: int = -1) -> unicode: ...
|
||||
def readlines(self, hint: int = -1) -> List[unicode]: ...
|
||||
def seek(self, offset: int, whence: int = 0) -> None: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def tell(self) -> int: ...
|
||||
def truncate(self, size: int = None) -> int: ...
|
||||
def writable(self) -> bool: ...
|
||||
def write(self, s: unicode) -> None: ...
|
||||
def writelines(self, lines: Iterable[unicode]) -> None: ...
|
||||
def getvalue(self) -> unicode: ...
|
||||
|
||||
def __iter__(self) -> Iterator[unicode]: ...
|
||||
def __enter__(self) -> 'StringIO': ...
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
|
||||
class TextIOWrapper(TextIO):
|
||||
# write_through is undocumented but used by subprocess
|
||||
def __init__(self, buffer: IO[str], encoding: unicode = None,
|
||||
errors: unicode = None, newline: unicode = None,
|
||||
line_buffering: bool = False,
|
||||
write_through: bool = True) -> None: ...
|
||||
# TODO see comments in BinaryIO for missing functionality
|
||||
def close(self) -> None: ...
|
||||
def closed(self) -> bool: ...
|
||||
def fileno(self) -> int: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def read(self, n: int = -1) -> unicode: ...
|
||||
def readable(self) -> bool: ...
|
||||
def readline(self, limit: int = -1) -> unicode: ...
|
||||
def readlines(self, hint: int = -1) -> List[unicode]: ...
|
||||
def seek(self, offset: int, whence: int = 0) -> None: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def tell(self) -> int: ...
|
||||
def truncate(self, size: int = None) -> int: ...
|
||||
def writable(self) -> bool: ...
|
||||
def write(self, s: unicode) -> None: ...
|
||||
def writelines(self, lines: Iterable[unicode]) -> None: ...
|
||||
|
||||
def __iter__(self) -> Iterator[unicode]: ...
|
||||
def __enter__(self) -> StringIO: ...
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
|
||||
class BufferedIOBase(IOBase): ...
|
||||
@@ -0,0 +1,12 @@
|
||||
from typing import Any, IO
|
||||
|
||||
class JSONDecodeError(object):
|
||||
def dumps(self, obj: Any) -> str: ...
|
||||
def dump(self, obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ...
|
||||
def loads(self, s: str) -> Any: ...
|
||||
def load(self, fp: IO[str]) -> Any: ...
|
||||
|
||||
def dumps(obj: Any, sort_keys: bool = None, indent: int = None) -> str: ...
|
||||
def dump(obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ...
|
||||
def loads(s: str) -> Any: ...
|
||||
def load(fp: IO[str]) -> Any: ...
|
||||
@@ -0,0 +1,239 @@
|
||||
# Stubs for logging (Python 2.7)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Dict, Optional, Sequence, Tuple, overload
|
||||
|
||||
CRITICAL = 0
|
||||
FATAL = 0
|
||||
ERROR = 0
|
||||
WARNING = 0
|
||||
WARN = 0
|
||||
INFO = 0
|
||||
DEBUG = 0
|
||||
NOTSET = 0
|
||||
|
||||
def getLevelName(level: int) -> str: ...
|
||||
def addLevelName(level: int, levelName: str) -> None: ...
|
||||
|
||||
class LogRecord:
|
||||
name = ... # type: str
|
||||
msg = ... # type: str
|
||||
args = ... # type: Sequence[Any]
|
||||
levelname = ... # type: str
|
||||
levelno = ... # type: int
|
||||
pathname = ... # type: str
|
||||
filename = ... # type: str
|
||||
module = ... # type: str
|
||||
exc_info = ... # type: Tuple[Any, Any, Any]
|
||||
exc_text = ... # type: str
|
||||
lineno = ... # type: int
|
||||
funcName = ... # type: Optional[str]
|
||||
created = ... # type: float
|
||||
msecs = ... # type: float
|
||||
relativeCreated = ... # type: float
|
||||
thread = ... # type: Any
|
||||
threadName = ... # type: Any
|
||||
processName = ... # type: Any
|
||||
process = ... # type: Any
|
||||
def __init__(self, name: str, level: int, pathname: str, lineno: int, msg: str,
|
||||
args: Sequence[Any], exc_info: Tuple[Any, Any, Any], func: str = None) -> None: ...
|
||||
def getMessage(self) -> str: ...
|
||||
|
||||
def makeLogRecord(dict: Dict[str, Any]) -> LogRecord: ...
|
||||
|
||||
class PercentStyle:
|
||||
default_format = ... # type: Any
|
||||
asctime_format = ... # type: Any
|
||||
asctime_search = ... # type: Any
|
||||
def __init__(self, fmt): ...
|
||||
def usesTime(self): ...
|
||||
def format(self, record): ...
|
||||
|
||||
class StrFormatStyle(PercentStyle):
|
||||
default_format = ... # type: Any
|
||||
asctime_format = ... # type: Any
|
||||
asctime_search = ... # type: Any
|
||||
def format(self, record): ...
|
||||
|
||||
class StringTemplateStyle(PercentStyle):
|
||||
default_format = ... # type: Any
|
||||
asctime_format = ... # type: Any
|
||||
asctime_search = ... # type: Any
|
||||
def __init__(self, fmt): ...
|
||||
def usesTime(self): ...
|
||||
def format(self, record): ...
|
||||
|
||||
BASIC_FORMAT = ... # type: Any
|
||||
|
||||
class Formatter:
|
||||
converter = ... # type: Any
|
||||
datefmt = ... # type: Any
|
||||
def __init__(self, fmt: str = None, datefmt: str = None) -> None: ...
|
||||
default_time_format = ... # type: Any
|
||||
default_msec_format = ... # type: Any
|
||||
def formatTime(self, record, datefmt=None): ...
|
||||
def formatException(self, ei): ...
|
||||
def usesTime(self): ...
|
||||
def formatMessage(self, record): ...
|
||||
def formatStack(self, stack_info): ...
|
||||
def format(self, record: LogRecord) -> str: ...
|
||||
|
||||
class BufferingFormatter:
|
||||
linefmt = ... # type: Any
|
||||
def __init__(self, linefmt=None): ...
|
||||
def formatHeader(self, records): ...
|
||||
def formatFooter(self, records): ...
|
||||
def format(self, records): ...
|
||||
|
||||
class Filter:
|
||||
name = ... # type: Any
|
||||
nlen = ... # type: Any
|
||||
def __init__(self, name: str = '') -> None: ...
|
||||
def filter(self, record: LogRecord) -> int: ...
|
||||
|
||||
class Filterer:
|
||||
filters = ... # type: Any
|
||||
def __init__(self) -> None: ...
|
||||
def addFilter(self, filter: Filter) -> None: ...
|
||||
def removeFilter(self, filter: Filter) -> None: ...
|
||||
def filter(self, record: LogRecord) -> int: ...
|
||||
|
||||
class Handler(Filterer):
|
||||
level = ... # type: Any
|
||||
formatter = ... # type: Any
|
||||
def __init__(self, level: int = ...) -> None: ...
|
||||
def get_name(self): ...
|
||||
def set_name(self, name): ...
|
||||
name = ... # type: Any
|
||||
lock = ... # type: Any
|
||||
def createLock(self): ...
|
||||
def acquire(self): ...
|
||||
def release(self): ...
|
||||
def setLevel(self, level: int) -> None: ...
|
||||
def format(self, record: LogRecord) -> str: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
def handle(self, record: LogRecord) -> Any: ... # Return value undocumented
|
||||
def setFormatter(self, fmt: Formatter) -> None: ...
|
||||
def flush(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def handleError(self, record: LogRecord) -> None: ...
|
||||
|
||||
class StreamHandler(Handler):
|
||||
terminator = ... # type: Any
|
||||
stream = ... # type: Any
|
||||
def __init__(self, stream=None): ...
|
||||
def flush(self): ...
|
||||
def emit(self, record): ...
|
||||
|
||||
class FileHandler(StreamHandler):
|
||||
baseFilename = ... # type: Any
|
||||
mode = ... # type: Any
|
||||
encoding = ... # type: Any
|
||||
delay = ... # type: Any
|
||||
stream = ... # type: Any
|
||||
def __init__(self, filename: str, mode: str = ..., encoding: str = None, delay: int = ...) -> None: ...
|
||||
def close(self): ...
|
||||
def emit(self, record): ...
|
||||
|
||||
class _StderrHandler(StreamHandler):
|
||||
def __init__(self, level=...): ...
|
||||
|
||||
lastResort = ... # type: Any
|
||||
|
||||
class PlaceHolder:
|
||||
loggerMap = ... # type: Any
|
||||
def __init__(self, alogger): ...
|
||||
def append(self, alogger): ...
|
||||
|
||||
def setLoggerClass(klass): ...
|
||||
def getLoggerClass(): ...
|
||||
|
||||
class Manager:
|
||||
root = ... # type: Any
|
||||
disable = ... # type: Any
|
||||
emittedNoHandlerWarning = ... # type: Any
|
||||
loggerDict = ... # type: Any
|
||||
loggerClass = ... # type: Any
|
||||
logRecordFactory = ... # type: Any
|
||||
def __init__(self, rootnode): ...
|
||||
def getLogger(self, name): ...
|
||||
def setLoggerClass(self, klass): ...
|
||||
def setLogRecordFactory(self, factory): ...
|
||||
|
||||
class Logger(Filterer):
|
||||
name = ... # type: Any
|
||||
level = ... # type: Any
|
||||
parent = ... # type: Any
|
||||
propagate = False
|
||||
handlers = ... # type: Any
|
||||
disabled = ... # type: Any
|
||||
def __init__(self, name: str, level: int = ...) -> None: ...
|
||||
def setLevel(self, level: int) -> None: ...
|
||||
def debug(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def info(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def warning(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def warn(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def error(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def exception(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def critical(self, msg: str, *args, **kwargs) -> None: ...
|
||||
fatal = ... # type: Any
|
||||
def log(self, level: int, msg: str, *args, **kwargs) -> None: ...
|
||||
def findCaller(self) -> Tuple[str, int, str]: ...
|
||||
def makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None,
|
||||
sinfo=None): ...
|
||||
def handle(self, record): ...
|
||||
def addHandler(self, hdlr: Handler) -> None: ...
|
||||
def removeHandler(self, hdlr: Handler) -> None: ...
|
||||
def hasHandlers(self): ...
|
||||
def callHandlers(self, record): ...
|
||||
def getEffectiveLevel(self) -> int: ...
|
||||
def isEnabledFor(self, level: int) -> bool: ...
|
||||
def getChild(self, suffix: str) -> Logger: ...
|
||||
|
||||
class RootLogger(Logger):
|
||||
def __init__(self, level): ...
|
||||
|
||||
class LoggerAdapter:
|
||||
logger = ... # type: Any
|
||||
extra = ... # type: Any
|
||||
def __init__(self, logger, extra): ...
|
||||
def process(self, msg, kwargs): ...
|
||||
def debug(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def info(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def warning(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def warn(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def error(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def exception(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def critical(self, msg: str, *args, **kwargs) -> None: ...
|
||||
def log(self, level: int, msg: str, *args, **kwargs) -> None: ...
|
||||
def isEnabledFor(self, level: int) -> bool: ...
|
||||
def setLevel(self, level: int) -> None: ...
|
||||
def getEffectiveLevel(self) -> int: ...
|
||||
def hasHandlers(self): ...
|
||||
|
||||
def basicConfig(**kwargs) -> None: ...
|
||||
def getLogger(name: str = None) -> Logger: ...
|
||||
def critical(msg: str, *args, **kwargs) -> None: ...
|
||||
|
||||
fatal = ... # type: Any
|
||||
|
||||
def error(msg: str, *args, **kwargs) -> None: ...
|
||||
@overload
|
||||
def exception(msg: str, *args, **kwargs) -> None: ...
|
||||
@overload
|
||||
def exception(exception: Exception, *args, **kwargs) -> None: ...
|
||||
def warning(msg: str, *args, **kwargs) -> None: ...
|
||||
def warn(msg: str, *args, **kwargs) -> None: ...
|
||||
def info(msg: str, *args, **kwargs) -> None: ...
|
||||
def debug(msg: str, *args, **kwargs) -> None: ...
|
||||
def log(level: int, msg: str, *args, **kwargs) -> None: ...
|
||||
def disable(level: int) -> None: ...
|
||||
|
||||
class NullHandler(Handler):
|
||||
def handle(self, record): ...
|
||||
def emit(self, record): ...
|
||||
lock = ... # type: Any
|
||||
def createLock(self): ...
|
||||
|
||||
def captureWarnings(capture: bool) -> None: ...
|
||||
@@ -0,0 +1,200 @@
|
||||
# Stubs for logging.handlers (Python 2.7)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
import logging
|
||||
|
||||
threading = ... # type: Any
|
||||
DEFAULT_TCP_LOGGING_PORT = ... # type: Any
|
||||
DEFAULT_UDP_LOGGING_PORT = ... # type: Any
|
||||
DEFAULT_HTTP_LOGGING_PORT = ... # type: Any
|
||||
DEFAULT_SOAP_LOGGING_PORT = ... # type: Any
|
||||
SYSLOG_UDP_PORT = ... # type: Any
|
||||
SYSLOG_TCP_PORT = ... # type: Any
|
||||
|
||||
class BaseRotatingHandler(logging.FileHandler):
|
||||
mode = ... # type: Any
|
||||
encoding = ... # type: Any
|
||||
namer = ... # type: Any
|
||||
rotator = ... # type: Any
|
||||
def __init__(self, filename, mode, encoding=None, delay=0): ...
|
||||
def emit(self, record): ...
|
||||
def rotation_filename(self, default_name): ...
|
||||
def rotate(self, source, dest): ...
|
||||
|
||||
class RotatingFileHandler(BaseRotatingHandler):
|
||||
maxBytes = ... # type: Any
|
||||
backupCount = ... # type: Any
|
||||
def __init__(self, filename: str, mode: str = ..., maxBytes: int = ..., backupCount:int = ...,
|
||||
encoding: str = None, delay: int = ...) -> None: ...
|
||||
stream = ... # type: Any
|
||||
def doRollover(self): ...
|
||||
def shouldRollover(self, record): ...
|
||||
|
||||
class TimedRotatingFileHandler(BaseRotatingHandler):
|
||||
when = ... # type: Any
|
||||
backupCount = ... # type: Any
|
||||
utc = ... # type: Any
|
||||
atTime = ... # type: Any
|
||||
interval = ... # type: Any
|
||||
suffix = ... # type: Any
|
||||
extMatch = ... # type: Any
|
||||
dayOfWeek = ... # type: Any
|
||||
rolloverAt = ... # type: Any
|
||||
def __init__(self, filename, when='', interval=1, backupCount=0, encoding=None, delay=0,
|
||||
utc=False, atTime=None): ...
|
||||
def computeRollover(self, currentTime): ...
|
||||
def shouldRollover(self, record): ...
|
||||
def getFilesToDelete(self): ...
|
||||
stream = ... # type: Any
|
||||
def doRollover(self): ...
|
||||
|
||||
class WatchedFileHandler(logging.FileHandler):
|
||||
def __init__(self, filename: str, mode: str = ..., encoding: str = None, delay: int = ...): ...
|
||||
stream = ... # type: Any
|
||||
def emit(self, record): ...
|
||||
|
||||
class SocketHandler(logging.Handler):
|
||||
host = ... # type: Any
|
||||
port = ... # type: Any
|
||||
address = ... # type: Any
|
||||
sock = ... # type: Any
|
||||
closeOnError = ... # type: Any
|
||||
retryTime = ... # type: Any
|
||||
retryStart = ... # type: Any
|
||||
retryMax = ... # type: Any
|
||||
retryFactor = ... # type: Any
|
||||
def __init__(self, host, port): ...
|
||||
def makeSocket(self, timeout=1): ...
|
||||
retryPeriod = ... # type: Any
|
||||
def createSocket(self): ...
|
||||
def send(self, s): ...
|
||||
def makePickle(self, record): ...
|
||||
def handleError(self, record): ...
|
||||
def emit(self, record): ...
|
||||
def close(self): ...
|
||||
|
||||
class DatagramHandler(SocketHandler):
|
||||
closeOnError = ... # type: Any
|
||||
def __init__(self, host, port): ...
|
||||
def makeSocket(self, timeout=1): ... # TODO: Actually does not have the timeout argument.
|
||||
def send(self, s): ...
|
||||
|
||||
class SysLogHandler(logging.Handler):
|
||||
LOG_EMERG = ... # type: Any
|
||||
LOG_ALERT = ... # type: Any
|
||||
LOG_CRIT = ... # type: Any
|
||||
LOG_ERR = ... # type: Any
|
||||
LOG_WARNING = ... # type: Any
|
||||
LOG_NOTICE = ... # type: Any
|
||||
LOG_INFO = ... # type: Any
|
||||
LOG_DEBUG = ... # type: Any
|
||||
LOG_KERN = ... # type: Any
|
||||
LOG_USER = ... # type: Any
|
||||
LOG_MAIL = ... # type: Any
|
||||
LOG_DAEMON = ... # type: Any
|
||||
LOG_AUTH = ... # type: Any
|
||||
LOG_SYSLOG = ... # type: Any
|
||||
LOG_LPR = ... # type: Any
|
||||
LOG_NEWS = ... # type: Any
|
||||
LOG_UUCP = ... # type: Any
|
||||
LOG_CRON = ... # type: Any
|
||||
LOG_AUTHPRIV = ... # type: Any
|
||||
LOG_FTP = ... # type: Any
|
||||
LOG_LOCAL0 = ... # type: Any
|
||||
LOG_LOCAL1 = ... # type: Any
|
||||
LOG_LOCAL2 = ... # type: Any
|
||||
LOG_LOCAL3 = ... # type: Any
|
||||
LOG_LOCAL4 = ... # type: Any
|
||||
LOG_LOCAL5 = ... # type: Any
|
||||
LOG_LOCAL6 = ... # type: Any
|
||||
LOG_LOCAL7 = ... # type: Any
|
||||
priority_names = ... # type: Any
|
||||
facility_names = ... # type: Any
|
||||
priority_map = ... # type: Any
|
||||
address = ... # type: Any
|
||||
facility = ... # type: Any
|
||||
socktype = ... # type: Any
|
||||
unixsocket = ... # type: Any
|
||||
socket = ... # type: Any
|
||||
formatter = ... # type: Any
|
||||
def __init__(self, address=..., facility=..., socktype=None): ...
|
||||
def encodePriority(self, facility, priority): ...
|
||||
def close(self): ...
|
||||
def mapPriority(self, levelName): ...
|
||||
ident = ... # type: Any
|
||||
append_nul = ... # type: Any
|
||||
def emit(self, record): ...
|
||||
|
||||
class SMTPHandler(logging.Handler):
|
||||
username = ... # type: Any
|
||||
fromaddr = ... # type: Any
|
||||
toaddrs = ... # type: Any
|
||||
subject = ... # type: Any
|
||||
secure = ... # type: Any
|
||||
timeout = ... # type: Any
|
||||
def __init__(self, mailhost, fromaddr, toaddrs, subject, credentials=None, secure=None,
|
||||
timeout=0.0): ...
|
||||
def getSubject(self, record): ...
|
||||
def emit(self, record): ...
|
||||
|
||||
class NTEventLogHandler(logging.Handler):
|
||||
appname = ... # type: Any
|
||||
dllname = ... # type: Any
|
||||
logtype = ... # type: Any
|
||||
deftype = ... # type: Any
|
||||
typemap = ... # type: Any
|
||||
def __init__(self, appname, dllname=None, logtype=''): ...
|
||||
def getMessageID(self, record): ...
|
||||
def getEventCategory(self, record): ...
|
||||
def getEventType(self, record): ...
|
||||
def emit(self, record): ...
|
||||
def close(self): ...
|
||||
|
||||
class HTTPHandler(logging.Handler):
|
||||
host = ... # type: Any
|
||||
url = ... # type: Any
|
||||
method = ... # type: Any
|
||||
secure = ... # type: Any
|
||||
credentials = ... # type: Any
|
||||
def __init__(self, host, url, method='', secure=False, credentials=None): ...
|
||||
def mapLogRecord(self, record): ...
|
||||
def emit(self, record): ...
|
||||
|
||||
class BufferingHandler(logging.Handler):
|
||||
capacity = ... # type: Any
|
||||
buffer = ... # type: Any
|
||||
def __init__(self, capacity: int) -> None: ...
|
||||
def shouldFlush(self, record): ...
|
||||
def emit(self, record): ...
|
||||
def flush(self): ...
|
||||
def close(self): ...
|
||||
|
||||
class MemoryHandler(BufferingHandler):
|
||||
flushLevel = ... # type: Any
|
||||
target = ... # type: Any
|
||||
def __init__(self, capacity, flushLevel=..., target=None): ...
|
||||
def shouldFlush(self, record): ...
|
||||
def setTarget(self, target): ...
|
||||
buffer = ... # type: Any
|
||||
def flush(self): ...
|
||||
def close(self): ...
|
||||
|
||||
class QueueHandler(logging.Handler):
|
||||
queue = ... # type: Any
|
||||
def __init__(self, queue): ...
|
||||
def enqueue(self, record): ...
|
||||
def prepare(self, record): ...
|
||||
def emit(self, record): ...
|
||||
|
||||
class QueueListener:
|
||||
queue = ... # type: Any
|
||||
handlers = ... # type: Any
|
||||
def __init__(self, queue, *handlers): ...
|
||||
def dequeue(self, block): ...
|
||||
def start(self): ...
|
||||
def prepare(self, record): ...
|
||||
def handle(self, record): ...
|
||||
def enqueue_sentinel(self): ...
|
||||
def stop(self): ...
|
||||
@@ -0,0 +1,11 @@
|
||||
# Stubs for Python 2.7 md5 stdlib module
|
||||
|
||||
class md5(object):
|
||||
def update(self, arg: str) -> None: ...
|
||||
def digest(self) -> str: ...
|
||||
def hexdigest(self) -> str: ...
|
||||
def copy(self) -> md5: ...
|
||||
|
||||
def new(string: str = None) -> md5: ...
|
||||
blocksize = 0
|
||||
digest_size = 0
|
||||
@@ -0,0 +1,77 @@
|
||||
# Stubs for numbers (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class Number:
|
||||
__metaclass__ = ... # type: Any
|
||||
__hash__ = ... # type: Any
|
||||
|
||||
class Complex(Number):
|
||||
def __complex__(self): ...
|
||||
def __nonzero__(self): ...
|
||||
def real(self): ...
|
||||
def imag(self): ...
|
||||
def __add__(self, other): ...
|
||||
def __radd__(self, other): ...
|
||||
def __neg__(self): ...
|
||||
def __pos__(self): ...
|
||||
def __sub__(self, other): ...
|
||||
def __rsub__(self, other): ...
|
||||
def __mul__(self, other): ...
|
||||
def __rmul__(self, other): ...
|
||||
def __div__(self, other): ...
|
||||
def __rdiv__(self, other): ...
|
||||
def __truediv__(self, other): ...
|
||||
def __rtruediv__(self, other): ...
|
||||
def __pow__(self, exponent): ...
|
||||
def __rpow__(self, base): ...
|
||||
def __abs__(self): ...
|
||||
def conjugate(self): ...
|
||||
def __eq__(self, other): ...
|
||||
def __ne__(self, other): ...
|
||||
|
||||
class Real(Complex):
|
||||
def __float__(self): ...
|
||||
def __trunc__(self): ...
|
||||
def __divmod__(self, other): ...
|
||||
def __rdivmod__(self, other): ...
|
||||
def __floordiv__(self, other): ...
|
||||
def __rfloordiv__(self, other): ...
|
||||
def __mod__(self, other): ...
|
||||
def __rmod__(self, other): ...
|
||||
def __lt__(self, other): ...
|
||||
def __le__(self, other): ...
|
||||
def __complex__(self): ...
|
||||
@property
|
||||
def real(self): ...
|
||||
@property
|
||||
def imag(self): ...
|
||||
def conjugate(self): ...
|
||||
|
||||
class Rational(Real):
|
||||
def numerator(self): ...
|
||||
def denominator(self): ...
|
||||
def __float__(self): ...
|
||||
|
||||
class Integral(Rational):
|
||||
def __long__(self): ...
|
||||
def __index__(self): ...
|
||||
def __pow__(self, exponent, modulus=None): ...
|
||||
def __lshift__(self, other): ...
|
||||
def __rlshift__(self, other): ...
|
||||
def __rshift__(self, other): ...
|
||||
def __rrshift__(self, other): ...
|
||||
def __and__(self, other): ...
|
||||
def __rand__(self, other): ...
|
||||
def __xor__(self, other): ...
|
||||
def __rxor__(self, other): ...
|
||||
def __or__(self, other): ...
|
||||
def __ror__(self, other): ...
|
||||
def __invert__(self): ...
|
||||
def __float__(self): ...
|
||||
@property
|
||||
def numerator(self): ...
|
||||
@property
|
||||
def denominator(self): ...
|
||||
@@ -0,0 +1,184 @@
|
||||
# created from https://docs.python.org/2/library/os.html
|
||||
|
||||
from typing import List, Tuple, Union, Sequence, Mapping, IO, Any, Optional, AnyStr
|
||||
import os.path as path
|
||||
|
||||
error = OSError
|
||||
name = ... # type: str
|
||||
environ = ... # type: Mapping[str, str]
|
||||
|
||||
def chdir(path: unicode) -> None: ...
|
||||
def fchdir(fd: int) -> None: ...
|
||||
def getcwd() -> str: ...
|
||||
def ctermid() -> str: ...
|
||||
def getegid() -> int: ...
|
||||
def geteuid() -> int: ...
|
||||
def getgid() -> int: ...
|
||||
def getgroups() -> List[int]: ...
|
||||
def initgroups(username: str, gid: int) -> None: ...
|
||||
def getlogin() -> str: ...
|
||||
def getpgid(pid: int) -> int: ...
|
||||
def getpgrp() -> int: ...
|
||||
def getpid() -> int: ...
|
||||
def getppid() -> int: ...
|
||||
def getresuid() -> Tuple[int, int, int]: ...
|
||||
def getresgid() -> Tuple[int, int, int]: ...
|
||||
def getuid() -> int: ...
|
||||
def getenv(varname: str, value: str = None) -> str: ...
|
||||
def putenv(varname: str, value: str) -> None: ...
|
||||
def setegid(egid: int) -> None: ...
|
||||
def seteuid(euid: int) -> None: ...
|
||||
def setgid(gid: int) -> None: ...
|
||||
def setgroups(groups: Sequence[int]) -> None: ...
|
||||
|
||||
# TODO(MichalPokorny)
|
||||
def setpgrp(*args) -> None: ...
|
||||
|
||||
def setpgid(pid: int, pgrp: int) -> None: ...
|
||||
def setregid(rgid: int, egid: int) -> None: ...
|
||||
def setresgid(rgid: int, egid: int, sgid: int) -> None: ...
|
||||
def setresuid(ruid: int, euid: int, suid: int) -> None: ...
|
||||
def setreuid(ruid: int, euid: int) -> None: ...
|
||||
def getsid(pid: int) -> int: ...
|
||||
def setsid() -> None: ...
|
||||
def setuid(pid: int) -> None: ...
|
||||
|
||||
def strerror(code: int) -> str:
|
||||
raise ValueError()
|
||||
|
||||
def umask(mask: int) -> int: ...
|
||||
def uname() -> Tuple[str, str, str, str, str]: ...
|
||||
def unsetenv(varname: str) -> None: ...
|
||||
|
||||
# TODO(MichalPokorny)
|
||||
def fdopen(fd: int, *args, **kwargs) -> IO[Any]: ...
|
||||
def popen(command: str, *args, **kwargs) -> Optional[IO[Any]]: ...
|
||||
def tmpfile() -> IO[Any]: ...
|
||||
|
||||
def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
|
||||
def popen3(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any], IO[Any]]: ...
|
||||
def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
|
||||
|
||||
def close(fd: int) -> None: ...
|
||||
def closerange(fd_low: int, fd_high: int) -> None: ...
|
||||
def dup(fd: int) -> int: ...
|
||||
def dup2(fd: int, fd2: int) -> None: ...
|
||||
def fchmod(fd: int, mode: int) -> None: ...
|
||||
def fchown(fd: int, uid: int, gid: int) -> None: ...
|
||||
def fdatasync(fd: int) -> None: ...
|
||||
def fpathconf(fd: int, name: str) -> None: ...
|
||||
|
||||
# TODO(prvak)
|
||||
def fstat(fd: int) -> Any: ...
|
||||
def fstatvfs(fd: int) -> Any: ...
|
||||
def fsync(fd: int) -> None: ...
|
||||
def ftruncate(fd: int, length: int) -> None: ...
|
||||
def isatty(fd: int) -> bool: ...
|
||||
|
||||
def lseek(fd: int, pos: int, how: int) -> None: ...
|
||||
SEEK_SET = 0
|
||||
SEEK_CUR = 1
|
||||
SEEK_END = 2
|
||||
|
||||
# TODO(prvak): maybe file should be unicode? (same with all other paths...)
|
||||
def open(file: unicode, flags: int, mode: int = 0777) -> int: ...
|
||||
def openpty() -> Tuple[int, int]: ...
|
||||
def pipe() -> Tuple[int, int]: ...
|
||||
def read(fd: int, n: int) -> str: ...
|
||||
def tcgetpgrp(fd: int) -> int: ...
|
||||
def tcsetpgrp(fd: int, pg: int) -> None: ...
|
||||
def ttyname(fd: int) -> str: ...
|
||||
def write(fd: int, str: str) -> int: ...
|
||||
|
||||
# TODO: O_*
|
||||
|
||||
def access(path: unicode, mode: int) -> bool: ...
|
||||
F_OK = 0
|
||||
R_OK = 0
|
||||
W_OK = 0
|
||||
X_OK = 0
|
||||
|
||||
def getcwdu() -> unicode: ...
|
||||
def chflags(path: unicode, flags: int) -> None: ...
|
||||
def chroot(path: unicode) -> None: ...
|
||||
def chmod(path: unicode, mode: int) -> None: ...
|
||||
def chown(path: unicode, uid: int, gid: int) -> None: ...
|
||||
def lchflags(path: unicode, flags: int) -> None: ...
|
||||
def lchmod(path: unicode, uid: int, gid: int) -> None: ...
|
||||
def lchown(path: unicode, uid: int, gid: int) -> None: ...
|
||||
def link(source: unicode, link_name: unicode) -> None: ...
|
||||
def listdir(path: AnyStr) -> List[AnyStr]: ...
|
||||
|
||||
# TODO(MichalPokorny)
|
||||
def lstat(path: unicode) -> Any: ...
|
||||
|
||||
def mkfifo(path: unicode, mode: int = 0666) -> None: ...
|
||||
def mknod(filename: unicode, mode: int = 0600, device: int = 0) -> None: ...
|
||||
def major(device: int) -> int: ...
|
||||
def minor(device: int) -> int: ...
|
||||
def makedev(major: int, minor: int) -> int: ...
|
||||
def mkdir(path: unicode, mode: int = 0777) -> None: ...
|
||||
def makedirs(path: unicode, mode: int = 0777) -> None: ...
|
||||
def pathconf(path: unicode, name: str) -> str: ...
|
||||
|
||||
pathconf_names = ... # type: Mapping[str, int]
|
||||
|
||||
def readlink(path: AnyStr) -> AnyStr: ...
|
||||
def remove(path: unicode) -> None: ...
|
||||
def removedirs(path: unicode) -> None:
|
||||
raise OSError()
|
||||
def rename(src: unicode, dst: unicode) -> None: ...
|
||||
def renames(old: unicode, new: unicode) -> None: ...
|
||||
def rmdir(path: unicode) -> None: ...
|
||||
|
||||
# TODO(MichalPokorny)
|
||||
def stat(path: unicode) -> Any: ...
|
||||
|
||||
# TODO: stat_float_times, statvfs, tempnam, tmpnam, TMP_MAX, walk
|
||||
|
||||
def symlink(source: unicode, link_name: unicode) -> None: ...
|
||||
def unlink(path: unicode) -> None: ...
|
||||
def utime(path: unicode, times: Optional[Tuple[int, int]]) -> None: ...
|
||||
|
||||
def abort() -> None: ...
|
||||
# TODO: exec*, _exit, EX_*
|
||||
|
||||
def fork() -> int:
|
||||
raise OSError()
|
||||
|
||||
def forkpty() -> Tuple[int, int]:
|
||||
raise OSError()
|
||||
|
||||
def kill(pid: int, sig: int) -> None: ...
|
||||
def killpg(pgid: int, sig: int) -> None: ...
|
||||
def nice(increment: int) -> int: ...
|
||||
|
||||
# TODO: plock, popen*, spawn*, P_*
|
||||
|
||||
def startfile(path: unicode, operation: str) -> None: ...
|
||||
def system(command: unicode) -> int: ...
|
||||
def times() -> Tuple[float, float, float, float, float]: ...
|
||||
def wait() -> int: ...
|
||||
def waitpid(pid: int, options: int) -> int:
|
||||
raise OSError()
|
||||
# TODO: wait3, wait4, W...
|
||||
def confstr(name: Union[str, int]) -> Optional[str]: ...
|
||||
confstr_names = ... # type: Mapping[str, int]
|
||||
|
||||
def getloadavg() -> Tuple[float, float, float]:
|
||||
raise OSError()
|
||||
|
||||
def sysconf(name: Union[str, int]) -> int: ...
|
||||
sysconf_names = ... # type: Mapping[str, int]
|
||||
|
||||
curdir = ... # type: str
|
||||
pardir = ... # type: str
|
||||
sep = ... # type: str
|
||||
altsep = ... # type: str
|
||||
extsep = ... # type: str
|
||||
pathsep = ... # type: str
|
||||
defpath = ... # type: str
|
||||
linesep = ... # type: str
|
||||
devnll = ... # type: str
|
||||
|
||||
def urandom(n: int) -> str: ...
|
||||
@@ -0,0 +1,65 @@
|
||||
# Stubs for os.path
|
||||
# Ron Murawski <ron@horizonchess.com>
|
||||
|
||||
# based on http://docs.python.org/3.2/library/os.path.html
|
||||
# adapted for 2.7 by Michal Pokorny
|
||||
|
||||
from typing import overload, List, Any, Tuple, BinaryIO, TextIO, TypeVar, Callable, AnyStr
|
||||
|
||||
# ----- os.path variables -----
|
||||
supports_unicode_filenames = False
|
||||
# aliases (also in os)
|
||||
curdir = ''
|
||||
pardir = ''
|
||||
sep = ''
|
||||
altsep = ''
|
||||
extsep = ''
|
||||
pathsep = ''
|
||||
defpath = ''
|
||||
devnull = ''
|
||||
|
||||
# ----- os.path function stubs -----
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
def basename(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
def commonprefix(list: List[AnyStr]) -> AnyStr: ...
|
||||
def dirname(path: AnyStr) -> AnyStr: ...
|
||||
def exists(path: unicode) -> bool: ...
|
||||
def lexists(path: unicode) -> bool: ...
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(path: unicode) -> float: ...
|
||||
def getmtime(path: unicode) -> float: ...
|
||||
def getctime(path: unicode) -> float: ...
|
||||
|
||||
def getsize(path: unicode) -> int: ...
|
||||
def isabs(path: unicode) -> bool: ...
|
||||
def isfile(path: unicode) -> bool: ...
|
||||
def isdir(path: unicode) -> bool: ...
|
||||
def islink(path: unicode) -> bool: ...
|
||||
def ismount(path: unicode) -> bool: ...
|
||||
|
||||
def join(path: AnyStr, *paths: AnyStr) -> AnyStr: ...
|
||||
|
||||
def normcase(path: AnyStr) -> AnyStr: ...
|
||||
def normpath(path: AnyStr) -> AnyStr: ...
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
def relpath(path: AnyStr, start: AnyStr = None) -> AnyStr: ...
|
||||
|
||||
def samefile(path1: unicode, path2: unicode) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
# TODO
|
||||
#def samestat(stat1: stat_result,
|
||||
# stat2: stat_result) -> bool: ... # Unix only
|
||||
|
||||
def split(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitdrive(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # Windows only, deprecated
|
||||
|
||||
_T = TypeVar('_T')
|
||||
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
|
||||
@@ -0,0 +1,8 @@
|
||||
# Stubs for pickle (Python 2)
|
||||
|
||||
from typing import Any, IO
|
||||
|
||||
def dump(obj: Any, file: IO[str], protocol: int = None) -> None: ...
|
||||
def dumps(obj: Any, protocol: int = None) -> str: ...
|
||||
def load(file: IO[str]) -> Any: ...
|
||||
def loads(str: str) -> Any: ...
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Any, IO
|
||||
|
||||
class Template:
|
||||
def __init__(self) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def clone(self) -> Template: ...
|
||||
def debug(flag: bool) -> None: ...
|
||||
def append(cmd: str, kind: str) -> None: ...
|
||||
def prepend(cmd: str, kind: str) -> None: ...
|
||||
def open(file: str, mode: str) -> IO[Any]: ...
|
||||
def copy(infile: str, outfile: str) -> None: ...
|
||||
|
||||
def quote(s: str) -> str: ...
|
||||
@@ -0,0 +1,21 @@
|
||||
# Stubs for pprint (Python 2)
|
||||
#
|
||||
# NOTE: Based on a dynamically typed automatically generated by stubgen.
|
||||
|
||||
from typing import IO, Any
|
||||
|
||||
def pprint(object: Any, stream: IO[Any] = None, indent: int = 1, width: int = 80,
|
||||
depth: int = None) -> None: ...
|
||||
def pformat(object, indent=1, width=80, depth=None): ...
|
||||
def saferepr(object): ...
|
||||
def isreadable(object): ...
|
||||
def isrecursive(object): ...
|
||||
|
||||
class PrettyPrinter:
|
||||
def __init__(self, indent: int = 1, width: int = 80, depth: int = None,
|
||||
stream: IO[Any] = None) -> None: ...
|
||||
def pprint(self, object): ...
|
||||
def pformat(self, object): ...
|
||||
def isrecursive(self, object): ...
|
||||
def isreadable(self, object): ...
|
||||
def format(self, object, context, maxlevels, level): ...
|
||||
@@ -0,0 +1,79 @@
|
||||
# Stubs for random
|
||||
# Ron Murawski <ron@horizonchess.com>
|
||||
# Updated by Jukka Lehtosalo
|
||||
|
||||
# based on https://docs.python.org/2/library/random.html
|
||||
|
||||
# ----- random classes -----
|
||||
|
||||
import _random
|
||||
from typing import (
|
||||
Any, TypeVar, Sequence, List, Callable, AbstractSet, Union,
|
||||
overload
|
||||
)
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class Random(_random.Random):
|
||||
def __init__(self, x: object = None) -> None: ...
|
||||
def seed(self, x: object = None) -> None: ...
|
||||
def getstate(self) -> tuple: ...
|
||||
def setstate(self, state: tuple) -> None: ...
|
||||
def jumpahead(self, n : int) -> None: ...
|
||||
def getrandbits(self, k: int) -> int: ...
|
||||
@overload
|
||||
def randrange(self, stop: int) -> int: ...
|
||||
@overload
|
||||
def randrange(self, start: int, stop: int, step: int = 1) -> int: ...
|
||||
def randint(self, a: int, b: int) -> int: ...
|
||||
def choice(self, seq: Sequence[_T]) -> _T: ...
|
||||
def shuffle(self, x: List[Any], random: Callable[[], None] = None) -> None: ...
|
||||
def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
|
||||
def random(self) -> float: ...
|
||||
def uniform(self, a: float, b: float) -> float: ...
|
||||
def triangular(self, low: float = 0.0, high: float = 1.0,
|
||||
mode: float = None) -> float: ...
|
||||
def betavariate(self, alpha: float, beta: float) -> float: ...
|
||||
def expovariate(self, lambd: float) -> float: ...
|
||||
def gammavariate(self, alpha: float, beta: float) -> float: ...
|
||||
def gauss(self, mu: float, sigma: float) -> float: ...
|
||||
def lognormvariate(self, mu: float, sigma: float) -> float: ...
|
||||
def normalvariate(self, mu: float, sigma: float) -> float: ...
|
||||
def vonmisesvariate(self, mu: float, kappa: float) -> float: ...
|
||||
def paretovariate(self, alpha: float) -> float: ...
|
||||
def weibullvariate(self, alpha: float, beta: float) -> float: ...
|
||||
|
||||
# SystemRandom is not implemented for all OS's; good on Windows & Linux
|
||||
class SystemRandom:
|
||||
def __init__(self, randseed: object = None) -> None: ...
|
||||
def random(self) -> float: ...
|
||||
def getrandbits(self, k: int) -> int: ...
|
||||
def seed(self, x: object = None) -> None: ...
|
||||
|
||||
# ----- random function stubs -----
|
||||
def seed(x: object = None) -> None: ...
|
||||
def getstate() -> object: ...
|
||||
def setstate(state: object) -> None: ...
|
||||
def jumpahead(n : int) -> None: ...
|
||||
def getrandbits(k: int) -> int: ...
|
||||
@overload
|
||||
def randrange(stop: int) -> int: ...
|
||||
@overload
|
||||
def randrange(start: int, stop: int, step: int = 1) -> int: ...
|
||||
def randint(a: int, b: int) -> int: ...
|
||||
def choice(seq: Sequence[_T]) -> _T: ...
|
||||
def shuffle(x: List[Any], random: Callable[[], float] = None) -> None: ...
|
||||
def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
|
||||
def random() -> float: ...
|
||||
def uniform(a: float, b: float) -> float: ...
|
||||
def triangular(low: float = 0.0, high: float = 1.0,
|
||||
mode: float = None) -> float: ...
|
||||
def betavariate(alpha: float, beta: float) -> float: ...
|
||||
def expovariate(lambd: float) -> float: ...
|
||||
def gammavariate(alpha: float, beta: float) -> float: ...
|
||||
def gauss(mu: float, sigma: float) -> float: ...
|
||||
def lognormvariate(mu: float, sigma: float) -> float: ...
|
||||
def normalvariate(mu: float, sigma: float) -> float: ...
|
||||
def vonmisesvariate(mu: float, kappa: float) -> float: ...
|
||||
def paretovariate(alpha: float) -> float: ...
|
||||
def weibullvariate(alpha: float, beta: float) -> float: ...
|
||||
@@ -0,0 +1,63 @@
|
||||
# Stubs for re
|
||||
# Ron Murawski <ron@horizonchess.com>
|
||||
# 'bytes' support added by Jukka Lehtosalo
|
||||
|
||||
# based on: http://docs.python.org/2.7/library/re.html
|
||||
|
||||
from typing import (
|
||||
List, Iterator, overload, Callable, Tuple, Sequence, Dict,
|
||||
Generic, AnyStr, Match, Pattern
|
||||
)
|
||||
|
||||
# ----- re variables and constants -----
|
||||
A = 0
|
||||
ASCII = 0
|
||||
DEBUG = 0
|
||||
I = 0
|
||||
IGNORECASE = 0
|
||||
L = 0
|
||||
LOCALE = 0
|
||||
M = 0
|
||||
MULTILINE = 0
|
||||
S = 0
|
||||
DOTALL = 0
|
||||
X = 0
|
||||
VERBOSE = 0
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
def compile(pattern: AnyStr, flags: int = 0) -> Pattern[AnyStr]: ...
|
||||
def search(pattern: AnyStr, string: AnyStr,
|
||||
flags: int = 0) -> Match[AnyStr]: ...
|
||||
def match(pattern: AnyStr, string: AnyStr,
|
||||
flags: int = 0) -> Match[AnyStr]: ...
|
||||
def split(pattern: AnyStr, string: AnyStr, maxsplit: int = 0,
|
||||
flags: int = 0) -> List[AnyStr]: ...
|
||||
def findall(pattern: AnyStr, string: AnyStr,
|
||||
flags: int = 0) -> List[AnyStr]: ...
|
||||
|
||||
# Return an iterator yielding match objects over all non-overlapping matches
|
||||
# for the RE pattern in string. The string is scanned left-to-right, and
|
||||
# matches are returned in the order found. Empty matches are included in the
|
||||
# result unless they touch the beginning of another match.
|
||||
def finditer(pattern: AnyStr, string: AnyStr,
|
||||
flags: int = 0) -> Iterator[Match[AnyStr]]: ...
|
||||
|
||||
@overload
|
||||
def sub(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = 0,
|
||||
flags: int = 0) -> AnyStr: ...
|
||||
@overload
|
||||
def sub(pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr],
|
||||
string: AnyStr, count: int = 0, flags: int = 0) -> AnyStr: ...
|
||||
|
||||
@overload
|
||||
def subn(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = 0,
|
||||
flags: int = 0) -> Tuple[AnyStr, int]: ...
|
||||
@overload
|
||||
def subn(pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr],
|
||||
string: AnyStr, count: int = 0,
|
||||
flags: int = 0) -> Tuple[AnyStr, int]: ...
|
||||
|
||||
def escape(string: AnyStr) -> AnyStr: ...
|
||||
|
||||
def purge() -> None: ...
|
||||
@@ -0,0 +1,12 @@
|
||||
# Stubs for Python 2.7 sha stdlib module
|
||||
|
||||
class sha(object):
|
||||
def update(self, arg: str) -> None: ...
|
||||
def digest(self) -> str: ...
|
||||
def hexdigest(self) -> str: ...
|
||||
def copy(self) -> sha: ...
|
||||
|
||||
def new(string: str = None) -> sha: ...
|
||||
blocksize = 0
|
||||
digest_size = 0
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
from typing import Optional, List, Any, IO
|
||||
|
||||
def split(s: Optional[str], comments: bool = False, posix: bool = True) -> List[str]: ...
|
||||
|
||||
class shlex:
|
||||
def __init__(self, instream: IO[Any] = None, infile: IO[Any] = None, posix: bool = True) -> None: ...
|
||||
def get_token(self) -> Optional[str]: ...
|
||||
def push_token(self, _str: str) -> None: ...
|
||||
def read_token(self) -> str: ...
|
||||
def sourcehook(self, filename: str) -> None: ...
|
||||
def push_source(self, stream: IO[Any], filename: str = None) -> None: ...
|
||||
def pop_source(self) -> IO[Any]: ...
|
||||
def error_leader(file: str = None, line: int = None) -> str: ...
|
||||
|
||||
commenters = ... # type: str
|
||||
wordchars = ... # type: str
|
||||
whitespace = ... # type: str
|
||||
escape = ... # type: str
|
||||
quotes = ... # type: str
|
||||
escapedquotes = ... # type: str
|
||||
whitespace_split = ... # type: bool
|
||||
infile = ... # type: IO[Any]
|
||||
source = ... # type: Optional[str]
|
||||
debug = ... # type: int
|
||||
lineno = ... # type: int
|
||||
token = ... # type: Any
|
||||
eof = ... # type: Optional[str]
|
||||
@@ -0,0 +1,30 @@
|
||||
# Stubs for shutil (Python 2)
|
||||
#
|
||||
# NOTE: Based on a dynamically typed stub automatically generated by stubgen.
|
||||
|
||||
from typing import List, Iterable, Callable, IO, AnyStr, Any, Tuple, Sequence
|
||||
|
||||
class Error(EnvironmentError): ...
|
||||
class SpecialFileError(EnvironmentError): ...
|
||||
class ExecError(EnvironmentError): ...
|
||||
|
||||
def copyfileobj(fsrc: IO[AnyStr], fdst: IO[AnyStr], length: int = ...) -> None: ...
|
||||
def copyfile(src: unicode, dst: unicode) -> None: ...
|
||||
def copymode(src: unicode, dst: unicode) -> None: ...
|
||||
def copystat(src: unicode, dst: unicode) -> None: ...
|
||||
def copy(src: unicode, dst: unicode) -> None: ...
|
||||
def copy2(src: unicode, dst: unicode) -> None: ...
|
||||
def ignore_patterns(*patterns: AnyStr) -> Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]]: ...
|
||||
def copytree(src: AnyStr, dst: AnyStr, symlinks: bool = False,
|
||||
ignore: Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]] = None) -> None: ...
|
||||
def rmtree(path: AnyStr, ignore_errors: bool = False,
|
||||
onerror: Callable[[Any, AnyStr, Any], None] = None) -> None: ...
|
||||
def move(src: unicode, dst: unicode) -> None: ...
|
||||
def get_archive_formats() -> List[Tuple[str, str]]: ...
|
||||
def register_archive_format(name: str, function: Callable[..., Any],
|
||||
extra_args: Sequence[Tuple[str, Any]] = None,
|
||||
description: str = '') -> None: ...
|
||||
def unregister_archive_format(name: str) -> None: ...
|
||||
def make_archive(base_name: AnyStr, format: str, root_dir: unicode = None,
|
||||
base_dir: unicode = None, verbose: int = 0, dry_run: int = 0,
|
||||
owner: str = None, group: str = None, logger: Any = None) -> AnyStr: ...
|
||||
@@ -0,0 +1,12 @@
|
||||
from typing import Any, IO
|
||||
|
||||
class JSONDecodeError(ValueError):
|
||||
def dumps(self, obj: Any) -> str: ...
|
||||
def dump(self, obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ...
|
||||
def loads(self, s: str) -> Any: ...
|
||||
def load(self, fp: IO[str]) -> Any: ...
|
||||
|
||||
def dumps(obj: Any) -> str: ...
|
||||
def dump(obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ...
|
||||
def loads(s: str, **kwds: Any) -> Any: ...
|
||||
def load(fp: IO[str]) -> Any: ...
|
||||
@@ -0,0 +1,90 @@
|
||||
# Stubs for smtplib (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class SMTPException(Exception): ...
|
||||
class SMTPServerDisconnected(SMTPException): ...
|
||||
|
||||
class SMTPResponseException(SMTPException):
|
||||
smtp_code = ... # type: Any
|
||||
smtp_error = ... # type: Any
|
||||
args = ... # type: Any
|
||||
def __init__(self, code, msg): ...
|
||||
|
||||
class SMTPSenderRefused(SMTPResponseException):
|
||||
smtp_code = ... # type: Any
|
||||
smtp_error = ... # type: Any
|
||||
sender = ... # type: Any
|
||||
args = ... # type: Any
|
||||
def __init__(self, code, msg, sender): ...
|
||||
|
||||
class SMTPRecipientsRefused(SMTPException):
|
||||
recipients = ... # type: Any
|
||||
args = ... # type: Any
|
||||
def __init__(self, recipients): ...
|
||||
|
||||
class SMTPDataError(SMTPResponseException): ...
|
||||
class SMTPConnectError(SMTPResponseException): ...
|
||||
class SMTPHeloError(SMTPResponseException): ...
|
||||
class SMTPAuthenticationError(SMTPResponseException): ...
|
||||
|
||||
def quoteaddr(addr): ...
|
||||
def quotedata(data): ...
|
||||
|
||||
class SSLFakeFile:
|
||||
sslobj = ... # type: Any
|
||||
def __init__(self, sslobj): ...
|
||||
def readline(self, size=-1): ...
|
||||
def close(self): ...
|
||||
|
||||
class SMTP:
|
||||
debuglevel = ... # type: Any
|
||||
file = ... # type: Any
|
||||
helo_resp = ... # type: Any
|
||||
ehlo_msg = ... # type: Any
|
||||
ehlo_resp = ... # type: Any
|
||||
does_esmtp = ... # type: Any
|
||||
default_port = ... # type: Any
|
||||
timeout = ... # type: Any
|
||||
esmtp_features = ... # type: Any
|
||||
local_hostname = ... # type: Any
|
||||
def __init__(self, host: str = '', port: int = 0, local_hostname=None, timeout=...) -> None: ...
|
||||
def set_debuglevel(self, debuglevel): ...
|
||||
sock = ... # type: Any
|
||||
def connect(self, host='', port=0): ...
|
||||
def send(self, str): ...
|
||||
def putcmd(self, cmd, args=''): ...
|
||||
def getreply(self): ...
|
||||
def docmd(self, cmd, args=''): ...
|
||||
def helo(self, name=''): ...
|
||||
def ehlo(self, name=''): ...
|
||||
def has_extn(self, opt): ...
|
||||
def help(self, args=''): ...
|
||||
def rset(self): ...
|
||||
def noop(self): ...
|
||||
def mail(self, sender, options=...): ...
|
||||
def rcpt(self, recip, options=...): ...
|
||||
def data(self, msg): ...
|
||||
def verify(self, address): ...
|
||||
vrfy = ... # type: Any
|
||||
def expn(self, address): ...
|
||||
def ehlo_or_helo_if_needed(self): ...
|
||||
def login(self, user, password): ...
|
||||
def starttls(self, keyfile=None, certfile=None): ...
|
||||
def sendmail(self, from_addr, to_addrs, msg, mail_options=..., rcpt_options=...): ...
|
||||
def close(self): ...
|
||||
def quit(self): ...
|
||||
|
||||
class SMTP_SSL(SMTP):
|
||||
default_port = ... # type: Any
|
||||
keyfile = ... # type: Any
|
||||
certfile = ... # type: Any
|
||||
def __init__(self, host='', port=0, local_hostname=None, keyfile=None, certfile=None, timeout=...): ...
|
||||
|
||||
class LMTP(SMTP):
|
||||
ehlo_msg = ... # type: Any
|
||||
def __init__(self, host='', port=..., local_hostname=None): ...
|
||||
sock = ... # type: Any
|
||||
def connect(self, host='', port=0): ...
|
||||
@@ -0,0 +1,388 @@
|
||||
# Stubs for socket
|
||||
# Ron Murawski <ron@horizonchess.com>
|
||||
|
||||
# based on: http://docs.python.org/3.2/library/socket.html
|
||||
# see: http://hg.python.org/cpython/file/3d0686d90f55/Lib/socket.py
|
||||
# see: http://nullege.com/codes/search/socket
|
||||
# adapted for Python 2.7 by Michal Pokorny
|
||||
|
||||
from typing import Any, Tuple, overload, List, Optional, Union
|
||||
|
||||
# ----- variables and constants -----
|
||||
|
||||
AF_UNIX = 0
|
||||
AF_INET = 0
|
||||
AF_INET6 = 0
|
||||
SOCK_STREAM = 0
|
||||
SOCK_DGRAM = 0
|
||||
SOCK_RAW = 0
|
||||
SOCK_RDM = 0
|
||||
SOCK_SEQPACKET = 0
|
||||
SOCK_CLOEXEC = 0
|
||||
SOCK_NONBLOCK = 0
|
||||
SOMAXCONN = 0
|
||||
has_ipv6 = False
|
||||
_GLOBAL_DEFAULT_TIMEOUT = 0.0
|
||||
SocketType = ... # type: Any
|
||||
SocketIO = ... # type: Any
|
||||
|
||||
|
||||
# the following constants are included with Python 3.2.3 (Ubuntu)
|
||||
# some of the constants may be Linux-only
|
||||
# all Windows/Mac-specific constants are absent
|
||||
AF_APPLETALK = 0
|
||||
AF_ASH = 0
|
||||
AF_ATMPVC = 0
|
||||
AF_ATMSVC = 0
|
||||
AF_AX25 = 0
|
||||
AF_BLUETOOTH = 0
|
||||
AF_BRIDGE = 0
|
||||
AF_DECnet = 0
|
||||
AF_ECONET = 0
|
||||
AF_IPX = 0
|
||||
AF_IRDA = 0
|
||||
AF_KEY = 0
|
||||
AF_LLC = 0
|
||||
AF_NETBEUI = 0
|
||||
AF_NETLINK = 0
|
||||
AF_NETROM = 0
|
||||
AF_PACKET = 0
|
||||
AF_PPPOX = 0
|
||||
AF_ROSE = 0
|
||||
AF_ROUTE = 0
|
||||
AF_SECURITY = 0
|
||||
AF_SNA = 0
|
||||
AF_TIPC = 0
|
||||
AF_UNSPEC = 0
|
||||
AF_WANPIPE = 0
|
||||
AF_X25 = 0
|
||||
AI_ADDRCONFIG = 0
|
||||
AI_ALL = 0
|
||||
AI_CANONNAME = 0
|
||||
AI_NUMERICHOST = 0
|
||||
AI_NUMERICSERV = 0
|
||||
AI_PASSIVE = 0
|
||||
AI_V4MAPPED = 0
|
||||
BDADDR_ANY = 0
|
||||
BDADDR_LOCAL = 0
|
||||
BTPROTO_HCI = 0
|
||||
BTPROTO_L2CAP = 0
|
||||
BTPROTO_RFCOMM = 0
|
||||
BTPROTO_SCO = 0
|
||||
CAPI = 0
|
||||
EAGAIN = 0
|
||||
EAI_ADDRFAMILY = 0
|
||||
EAI_AGAIN = 0
|
||||
EAI_BADFLAGS = 0
|
||||
EAI_FAIL = 0
|
||||
EAI_FAMILY = 0
|
||||
EAI_MEMORY = 0
|
||||
EAI_NODATA = 0
|
||||
EAI_NONAME = 0
|
||||
EAI_OVERFLOW = 0
|
||||
EAI_SERVICE = 0
|
||||
EAI_SOCKTYPE = 0
|
||||
EAI_SYSTEM = 0
|
||||
EBADF = 0
|
||||
EINTR = 0
|
||||
EWOULDBLOCK = 0
|
||||
HCI_DATA_DIR = 0
|
||||
HCI_FILTER = 0
|
||||
HCI_TIME_STAMP = 0
|
||||
INADDR_ALLHOSTS_GROUP = 0
|
||||
INADDR_ANY = 0
|
||||
INADDR_BROADCAST = 0
|
||||
INADDR_LOOPBACK = 0
|
||||
INADDR_MAX_LOCAL_GROUP = 0
|
||||
INADDR_NONE = 0
|
||||
INADDR_UNSPEC_GROUP = 0
|
||||
IPPORT_RESERVED = 0
|
||||
IPPORT_USERRESERVED = 0
|
||||
IPPROTO_AH = 0
|
||||
IPPROTO_DSTOPTS = 0
|
||||
IPPROTO_EGP = 0
|
||||
IPPROTO_ESP = 0
|
||||
IPPROTO_FRAGMENT = 0
|
||||
IPPROTO_GRE = 0
|
||||
IPPROTO_HOPOPTS = 0
|
||||
IPPROTO_ICMP = 0
|
||||
IPPROTO_ICMPV6 = 0
|
||||
IPPROTO_IDP = 0
|
||||
IPPROTO_IGMP = 0
|
||||
IPPROTO_IP = 0
|
||||
IPPROTO_IPIP = 0
|
||||
IPPROTO_IPV6 = 0
|
||||
IPPROTO_NONE = 0
|
||||
IPPROTO_PIM = 0
|
||||
IPPROTO_PUP = 0
|
||||
IPPROTO_RAW = 0
|
||||
IPPROTO_ROUTING = 0
|
||||
IPPROTO_RSVP = 0
|
||||
IPPROTO_TCP = 0
|
||||
IPPROTO_TP = 0
|
||||
IPPROTO_UDP = 0
|
||||
IPV6_CHECKSUM = 0
|
||||
IPV6_DSTOPTS = 0
|
||||
IPV6_HOPLIMIT = 0
|
||||
IPV6_HOPOPTS = 0
|
||||
IPV6_JOIN_GROUP = 0
|
||||
IPV6_LEAVE_GROUP = 0
|
||||
IPV6_MULTICAST_HOPS = 0
|
||||
IPV6_MULTICAST_IF = 0
|
||||
IPV6_MULTICAST_LOOP = 0
|
||||
IPV6_NEXTHOP = 0
|
||||
IPV6_PKTINFO = 0
|
||||
IPV6_RECVDSTOPTS = 0
|
||||
IPV6_RECVHOPLIMIT = 0
|
||||
IPV6_RECVHOPOPTS = 0
|
||||
IPV6_RECVPKTINFO = 0
|
||||
IPV6_RECVRTHDR = 0
|
||||
IPV6_RECVTCLASS = 0
|
||||
IPV6_RTHDR = 0
|
||||
IPV6_RTHDRDSTOPTS = 0
|
||||
IPV6_RTHDR_TYPE_0 = 0
|
||||
IPV6_TCLASS = 0
|
||||
IPV6_UNICAST_HOPS = 0
|
||||
IPV6_V6ONLY = 0
|
||||
IP_ADD_MEMBERSHIP = 0
|
||||
IP_DEFAULT_MULTICAST_LOOP = 0
|
||||
IP_DEFAULT_MULTICAST_TTL = 0
|
||||
IP_DROP_MEMBERSHIP = 0
|
||||
IP_HDRINCL = 0
|
||||
IP_MAX_MEMBERSHIPS = 0
|
||||
IP_MULTICAST_IF = 0
|
||||
IP_MULTICAST_LOOP = 0
|
||||
IP_MULTICAST_TTL = 0
|
||||
IP_OPTIONS = 0
|
||||
IP_RECVOPTS = 0
|
||||
IP_RECVRETOPTS = 0
|
||||
IP_RETOPTS = 0
|
||||
IP_TOS = 0
|
||||
IP_TTL = 0
|
||||
MSG_CTRUNC = 0
|
||||
MSG_DONTROUTE = 0
|
||||
MSG_DONTWAIT = 0
|
||||
MSG_EOR = 0
|
||||
MSG_OOB = 0
|
||||
MSG_PEEK = 0
|
||||
MSG_TRUNC = 0
|
||||
MSG_WAITALL = 0
|
||||
NETLINK_DNRTMSG = 0
|
||||
NETLINK_FIREWALL = 0
|
||||
NETLINK_IP6_FW = 0
|
||||
NETLINK_NFLOG = 0
|
||||
NETLINK_ROUTE = 0
|
||||
NETLINK_USERSOCK = 0
|
||||
NETLINK_XFRM = 0
|
||||
NI_DGRAM = 0
|
||||
NI_MAXHOST = 0
|
||||
NI_MAXSERV = 0
|
||||
NI_NAMEREQD = 0
|
||||
NI_NOFQDN = 0
|
||||
NI_NUMERICHOST = 0
|
||||
NI_NUMERICSERV = 0
|
||||
PACKET_BROADCAST = 0
|
||||
PACKET_FASTROUTE = 0
|
||||
PACKET_HOST = 0
|
||||
PACKET_LOOPBACK = 0
|
||||
PACKET_MULTICAST = 0
|
||||
PACKET_OTHERHOST = 0
|
||||
PACKET_OUTGOING = 0
|
||||
PF_PACKET = 0
|
||||
SHUT_RD = 0
|
||||
SHUT_RDWR = 0
|
||||
SHUT_WR = 0
|
||||
SOL_HCI = 0
|
||||
SOL_IP = 0
|
||||
SOL_SOCKET = 0
|
||||
SOL_TCP = 0
|
||||
SOL_TIPC = 0
|
||||
SOL_UDP = 0
|
||||
SO_ACCEPTCONN = 0
|
||||
SO_BROADCAST = 0
|
||||
SO_DEBUG = 0
|
||||
SO_DONTROUTE = 0
|
||||
SO_ERROR = 0
|
||||
SO_KEEPALIVE = 0
|
||||
SO_LINGER = 0
|
||||
SO_OOBINLINE = 0
|
||||
SO_RCVBUF = 0
|
||||
SO_RCVLOWAT = 0
|
||||
SO_RCVTIMEO = 0
|
||||
SO_REUSEADDR = 0
|
||||
SO_SNDBUF = 0
|
||||
SO_SNDLOWAT = 0
|
||||
SO_SNDTIMEO = 0
|
||||
SO_TYPE = 0
|
||||
TCP_CORK = 0
|
||||
TCP_DEFER_ACCEPT = 0
|
||||
TCP_INFO = 0
|
||||
TCP_KEEPCNT = 0
|
||||
TCP_KEEPIDLE = 0
|
||||
TCP_KEEPINTVL = 0
|
||||
TCP_LINGER2 = 0
|
||||
TCP_MAXSEG = 0
|
||||
TCP_NODELAY = 0
|
||||
TCP_QUICKACK = 0
|
||||
TCP_SYNCNT = 0
|
||||
TCP_WINDOW_CLAMP = 0
|
||||
TIPC_ADDR_ID = 0
|
||||
TIPC_ADDR_NAME = 0
|
||||
TIPC_ADDR_NAMESEQ = 0
|
||||
TIPC_CFG_SRV = 0
|
||||
TIPC_CLUSTER_SCOPE = 0
|
||||
TIPC_CONN_TIMEOUT = 0
|
||||
TIPC_CRITICAL_IMPORTANCE = 0
|
||||
TIPC_DEST_DROPPABLE = 0
|
||||
TIPC_HIGH_IMPORTANCE = 0
|
||||
TIPC_IMPORTANCE = 0
|
||||
TIPC_LOW_IMPORTANCE = 0
|
||||
TIPC_MEDIUM_IMPORTANCE = 0
|
||||
TIPC_NODE_SCOPE = 0
|
||||
TIPC_PUBLISHED = 0
|
||||
TIPC_SRC_DROPPABLE = 0
|
||||
TIPC_SUBSCR_TIMEOUT = 0
|
||||
TIPC_SUB_CANCEL = 0
|
||||
TIPC_SUB_PORTS = 0
|
||||
TIPC_SUB_SERVICE = 0
|
||||
TIPC_TOP_SRV = 0
|
||||
TIPC_WAIT_FOREVER = 0
|
||||
TIPC_WITHDRAWN = 0
|
||||
TIPC_ZONE_SCOPE = 0
|
||||
|
||||
|
||||
# ----- exceptions -----
|
||||
class error(IOError):
|
||||
...
|
||||
|
||||
class herror(error):
|
||||
def __init__(self, herror: int, string: str) -> None: ...
|
||||
|
||||
class gaierror(error):
|
||||
def __init__(self, error: int, string: str) -> None: ...
|
||||
|
||||
class timeout(error):
|
||||
...
|
||||
|
||||
|
||||
# Addresses can be either tuples of varying lengths (AF_INET, AF_INET6,
|
||||
# AF_NETLINK, AF_TIPC) or strings (AF_UNIX).
|
||||
|
||||
# TODO AF_PACKET and AF_BLUETOOTH address objects
|
||||
|
||||
|
||||
# ----- classes -----
|
||||
class socket:
|
||||
family = 0
|
||||
type = 0
|
||||
proto = 0
|
||||
|
||||
def __init__(self, family: int = AF_INET, type: int = SOCK_STREAM,
|
||||
proto: int = 0, fileno: int = None) -> None: ...
|
||||
|
||||
# --- methods ---
|
||||
# second tuple item is an address
|
||||
def accept(self) -> Tuple['socket', Any]: ...
|
||||
|
||||
@overload
|
||||
def bind(self, address: tuple) -> None: ...
|
||||
@overload
|
||||
def bind(self, address: str) -> None: ...
|
||||
|
||||
def close(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def connect(self, address: tuple) -> None: ...
|
||||
@overload
|
||||
def connect(self, address: str) -> None: ...
|
||||
|
||||
@overload
|
||||
def connect_ex(self, address: tuple) -> int: ...
|
||||
@overload
|
||||
def connect_ex(self, address: str) -> int: ...
|
||||
|
||||
def detach(self) -> int: ...
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
# return value is an address
|
||||
def getpeername(self) -> Any: ...
|
||||
def getsockname(self) -> Any: ...
|
||||
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: str) -> str: ...
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: str, buflen: int) -> str: ...
|
||||
|
||||
def gettimeout(self) -> float: ...
|
||||
def ioctl(self, control: object,
|
||||
option: Tuple[int, int, int]) -> None: ...
|
||||
def listen(self, backlog: int) -> None: ...
|
||||
# TODO the return value may be BinaryIO or TextIO, depending on mode
|
||||
def makefile(self, mode: str = 'r', buffering: int = None,
|
||||
encoding: str = None, errors: str = None,
|
||||
newline: str = None) -> Any:
|
||||
...
|
||||
def recv(self, bufsize: int, flags: int = 0) -> str: ...
|
||||
|
||||
# return type is an address
|
||||
def recvfrom(self, bufsize: int, flags: int = 0) -> Any: ...
|
||||
def recvfrom_into(self, buffer: str, nbytes: int,
|
||||
flags: int = 0) -> Any: ...
|
||||
def recv_into(self, buffer: str, nbytes: int,
|
||||
flags: int = 0) -> Any: ...
|
||||
def send(self, data: str, flags=0) -> int: ...
|
||||
def sendall(self, data: str, flags=0) -> Any:
|
||||
... # return type: None on success
|
||||
|
||||
@overload
|
||||
def sendto(self, data: str, address: tuple, flags: int = 0) -> int: ...
|
||||
@overload
|
||||
def sendto(self, data: str, address: str, flags: int = 0) -> int: ...
|
||||
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
# TODO None valid for the value argument
|
||||
def settimeout(self, value: float) -> None: ...
|
||||
|
||||
@overload
|
||||
def setsockopt(self, level: int, optname: str, value: int) -> None: ...
|
||||
@overload
|
||||
def setsockopt(self, level: int, optname: str, value: str) -> None: ...
|
||||
|
||||
def shutdown(self, how: int) -> None: ...
|
||||
|
||||
|
||||
# ----- functions -----
|
||||
def create_connection(address: Tuple[str, int],
|
||||
timeout: float = _GLOBAL_DEFAULT_TIMEOUT,
|
||||
source_address: Tuple[str, int] = None) -> socket: ...
|
||||
|
||||
# the 5th tuple item is an address
|
||||
def getaddrinfo(
|
||||
host: Optional[str], port: Union[str, int, None], family: int = 0,
|
||||
socktype: int = 0, proto: int = 0, flags: int = 0) -> List[Tuple[int, int, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]:
|
||||
...
|
||||
|
||||
def getfqdn(name: str = '') -> str: ...
|
||||
def gethostbyname(hostname: str) -> str: ...
|
||||
def gethostbyname_ex(hostname: str) -> Tuple[str, List[str], List[str]]: ...
|
||||
def gethostname() -> str: ...
|
||||
def gethostbyaddr(ip_address: str) -> Tuple[str, List[str], List[str]]: ...
|
||||
def getnameinfo(sockaddr: tuple, flags: int) -> Tuple[str, int]: ...
|
||||
def getprotobyname(protocolname: str) -> int: ...
|
||||
def getservbyname(servicename: str, protocolname: str = None) -> int: ...
|
||||
def getservbyport(port: int, protocolname: str = None) -> str: ...
|
||||
def socketpair(family: int = AF_INET,
|
||||
type: int = SOCK_STREAM,
|
||||
proto: int = 0) -> Tuple[socket, socket]: ...
|
||||
def fromfd(fd: int, family: int, type: int, proto: int = 0) -> socket: ...
|
||||
def ntohl(x: int) -> int: ... # param & ret val are 32-bit ints
|
||||
def ntohs(x: int) -> int: ... # param & ret val are 16-bit ints
|
||||
def htonl(x: int) -> int: ... # param & ret val are 32-bit ints
|
||||
def htons(x: int) -> int: ... # param & ret val are 16-bit ints
|
||||
def inet_aton(ip_string: str) -> str: ... # ret val 4 bytes in length
|
||||
def inet_ntoa(packed_ip: str) -> str: ...
|
||||
def inet_pton(address_family: int, ip_string: str) -> str: ...
|
||||
def inet_ntop(address_family: int, packed_ip: str) -> str: ...
|
||||
# TODO the timeout may be None
|
||||
def getdefaulttimeout() -> float: ...
|
||||
def setdefaulttimeout(timeout: float) -> None: ...
|
||||
@@ -0,0 +1,58 @@
|
||||
def S_ISDIR(mode: int) -> bool: ...
|
||||
def S_ISCHR(mode: int) -> bool: ...
|
||||
def S_ISBLK(mode: int) -> bool: ...
|
||||
def S_ISREG(mode: int) -> bool: ...
|
||||
def S_ISFIFO(mode: int) -> bool: ...
|
||||
def S_ISLNK(mode: int) -> bool: ...
|
||||
def S_ISSOCK(mode: int) -> bool: ...
|
||||
|
||||
def S_IMODE(mode: int) -> int: ...
|
||||
def S_IFMT(mode: int) -> int: ...
|
||||
|
||||
ST_MODE = 0
|
||||
ST_INO = 0
|
||||
ST_DEV = 0
|
||||
ST_NLINK = 0
|
||||
ST_UID = 0
|
||||
ST_GID = 0
|
||||
ST_SIZE = 0
|
||||
ST_ATIME = 0
|
||||
ST_MTIME = 0
|
||||
ST_CTIME = 0
|
||||
ST_IFSOCK = 0
|
||||
ST_IFLNK = 0
|
||||
ST_IFREG = 0
|
||||
ST_IFBLK = 0
|
||||
ST_IFDIR = 0
|
||||
ST_IFCHR = 0
|
||||
ST_IFIFO = 0
|
||||
S_ISUID = 0
|
||||
S_ISGID = 0
|
||||
S_ISVTX = 0
|
||||
S_IRWXU = 0
|
||||
S_IRUSR = 0
|
||||
S_IWUSR = 0
|
||||
S_IXUSR = 0
|
||||
S_IRGRP = 0
|
||||
S_IWGRP = 0
|
||||
S_IXGRP = 0
|
||||
S_IRWXO = 0
|
||||
S_IROTH = 0
|
||||
S_IWOTH = 0
|
||||
S_IXOTH = 0
|
||||
S_ENFMT = 0
|
||||
S_IREAD = 0
|
||||
S_IWRITE = 0
|
||||
S_IEXEC = 0
|
||||
UF_NODUMP = 0
|
||||
UF_IMMUTABLE = 0
|
||||
UF_APPEND = 0
|
||||
UF_OPAQUE = 0
|
||||
UF_NOUNLINK = 0
|
||||
UF_COMPRESSED = 0
|
||||
UF_HIDDEN = 0
|
||||
SF_ARCHIVED = 0
|
||||
SF_IMMUTABLE = 0
|
||||
SF_APPEND = 0
|
||||
SF_NOUNLINK = 0
|
||||
SF_SNAPSHOT = 0
|
||||
@@ -0,0 +1,74 @@
|
||||
# Stubs for string
|
||||
|
||||
# Based on http://docs.python.org/3.2/library/string.html
|
||||
|
||||
from typing import Mapping, Sequence, Any, Optional, Union, List, Tuple, Iterable, AnyStr
|
||||
|
||||
ascii_letters = ''
|
||||
ascii_lowercase = ''
|
||||
ascii_uppercase = ''
|
||||
digits = ''
|
||||
hexdigits = ''
|
||||
letters = ''
|
||||
lowercase = ''
|
||||
octdigits = ''
|
||||
punctuation = ''
|
||||
printable = ''
|
||||
uppercase = ''
|
||||
whitespace = ''
|
||||
|
||||
def capwords(s: AnyStr, sep: AnyStr = None) -> AnyStr: ...
|
||||
# TODO: originally named 'from'
|
||||
def maketrans(_from: str, to: str) -> str: ...
|
||||
def atof(s: unicode) -> float: ...
|
||||
def atoi(s: unicode, base: int = 10) -> int: ...
|
||||
def atol(s: unicode, base: int = 10) -> int: ...
|
||||
def capitalize(word: AnyStr) -> AnyStr: ...
|
||||
def find(s: unicode, sub: unicode, start: int = None, end: int = None) -> int: ...
|
||||
def rfind(s: unicode, sub: unicode, start: int = None, end: int = None) -> int: ...
|
||||
def index(s: unicode, sub: unicode, start: int = None, end: int = None) -> int: ...
|
||||
def rindex(s: unicode, sub: unicode, start: int = None, end: int = None) -> int: ...
|
||||
def count(s: unicode, sub: unicode, start: int = None, end: int = None) -> int: ...
|
||||
def lower(s: AnyStr) -> AnyStr: ...
|
||||
def split(s: AnyStr, sep: AnyStr = None, maxsplit: int = -1) -> List[AnyStr]: ...
|
||||
def rsplit(s: AnyStr, sep: AnyStr = None, maxsplit: int = -1) -> List[AnyStr]: ...
|
||||
def splitfields(s: AnyStr, sep: AnyStr = None, maxsplit: int = -1) -> List[AnyStr]: ...
|
||||
def join(words: Iterable[AnyStr], sep: AnyStr = None) -> AnyStr: ...
|
||||
def joinfields(word: Iterable[AnyStr], sep: AnyStr = None) -> AnyStr: ...
|
||||
def lstrip(s: AnyStr, chars: AnyStr = None) -> AnyStr: ...
|
||||
def rstrip(s: AnyStr, chars: AnyStr = None) -> AnyStr: ...
|
||||
def strip(s: AnyStr, chars: AnyStr = None) -> AnyStr: ...
|
||||
def swapcase(s: AnyStr) -> AnyStr: ...
|
||||
def translate(s: str, table: str, deletechars: str = None) -> str: ...
|
||||
def upper(s: AnyStr) -> AnyStr: ...
|
||||
def ljust(s: AnyStr, width: int, fillhar: AnyStr = ' ') -> AnyStr: ...
|
||||
def rjust(s: AnyStr, width: int, fillhar: AnyStr = ' ') -> AnyStr: ...
|
||||
def center(s: AnyStr, width: int, fillhar: AnyStr = ' ') -> AnyStr: ...
|
||||
def zfill(s: AnyStr, width: int) -> AnyStr: ...
|
||||
def replace(s: AnyStr, old: AnyStr, new: AnyStr, maxreplace: int = None) -> AnyStr: ...
|
||||
|
||||
class Template(object):
|
||||
# TODO: Unicode support?
|
||||
template = ''
|
||||
|
||||
def __init__(self, template: str) -> None: ...
|
||||
def substitute(self, mapping: Mapping[str, str], **kwds: str) -> str: ...
|
||||
def safe_substitute(self, mapping: Mapping[str, str],
|
||||
**kwds: str) -> str: ...
|
||||
|
||||
# TODO(MichalPokorny): This is probably badly and/or loosely typed.
|
||||
class Formatter(object):
|
||||
def format(self, format_string: str, *args, **kwargs) -> str: ...
|
||||
def vformat(self, format_string: str, args: Sequence[Any],
|
||||
kwargs: Mapping[str, Any]) -> str: ...
|
||||
def parse(self, format_string: str) -> Iterable[Tuple[str, str, str, str]]: ...
|
||||
def get_field(self, field_name: str, args: Sequence[Any],
|
||||
kwargs: Mapping[str, Any]) -> Any: ...
|
||||
def get_value(self, key: Union[int, str], args: Sequence[Any],
|
||||
kwargs: Mapping[str, Any]) -> Any:
|
||||
raise IndexError()
|
||||
raise KeyError()
|
||||
def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any],
|
||||
kwargs: Mapping[str, Any]) -> None: ...
|
||||
def format_field(self, value: Any, format_spec: str) -> Any: ...
|
||||
def convert_field(self, value: Any, conversion: str) -> Any: ...
|
||||
@@ -0,0 +1,28 @@
|
||||
# Stubs for struct for Python 2.7
|
||||
# Based on https://docs.python.org/2/library/struct.html
|
||||
|
||||
from typing import Any, Tuple
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
def pack(fmt: str, *v: Any) -> str: ...
|
||||
# TODO buffer type
|
||||
def pack_into(fmt: str, buffer: Any, offset: int, *v: Any) -> None: ...
|
||||
|
||||
# TODO buffer type
|
||||
def unpack(fmt: str, buffer: Any) -> Tuple[Any, ...]: ...
|
||||
def unpack_from(fmt: str, buffer: Any, offset: int = ...) -> Tuple[Any, ...]: ...
|
||||
|
||||
def calcsize(fmt: str) -> int: ...
|
||||
|
||||
class Struct:
|
||||
format = ... # type: str
|
||||
size = ... # type: int
|
||||
|
||||
def __init__(self, format: str) -> None: ...
|
||||
|
||||
def pack(self, *v: Any) -> str: ...
|
||||
# TODO buffer type
|
||||
def pack_into(self, buffer: Any, offset: int, *v: Any) -> None: ...
|
||||
def unpack(self, buffer: Any) -> Tuple[Any, ...]: ...
|
||||
def unpack_from(self, buffer: Any, offset: int = ...) -> Tuple[Any, ...]: ...
|
||||
@@ -0,0 +1,79 @@
|
||||
# Stubs for subprocess
|
||||
|
||||
# Based on http://docs.python.org/2/library/subprocess.html and Python 3 stub
|
||||
|
||||
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Union, Optional
|
||||
|
||||
_FILE = Union[int, IO[Any]]
|
||||
|
||||
# TODO force keyword arguments
|
||||
# TODO more keyword arguments (from Popen)
|
||||
def call(args: Sequence[str], *,
|
||||
stdin: _FILE = None, stdout: _FILE = None, stderr: _FILE = None,
|
||||
shell: bool = False, env: Mapping[str, str] = None,
|
||||
cwd: str = None) -> int: ...
|
||||
def check_call(args: Sequence[str], *,
|
||||
stdin: _FILE = None, stdout: _FILE = None, stderr: _FILE = None,
|
||||
shell: bool = False, env: Mapping[str, str] = None, cwd: str = None,
|
||||
close_fds: Sequence[_FILE] = None, preexec_fn: Callable[[], Any] = None) -> int: ...
|
||||
def check_output(args: Sequence[str], *,
|
||||
stdin: _FILE = None, stderr: _FILE = None,
|
||||
shell: bool = False, universal_newlines: bool = False,
|
||||
env: Mapping[str, str] = None, cwd: str = None) -> str: ...
|
||||
|
||||
PIPE = ... # type: int
|
||||
STDOUT = ... # type: int
|
||||
|
||||
class CalledProcessError(Exception):
|
||||
returncode = 0
|
||||
cmd = ''
|
||||
output = '' # May be None
|
||||
|
||||
def __init__(self, returncode: int, cmd: str, output: str) -> None: ...
|
||||
|
||||
class Popen:
|
||||
stdin = ... # type: Optional[IO[Any]]
|
||||
stdout = ... # type: Optional[IO[Any]]
|
||||
stderr = ... # type: Optional[IO[Any]]
|
||||
pid = 0
|
||||
returncode = 0
|
||||
|
||||
def __init__(self,
|
||||
args: Sequence[str],
|
||||
bufsize: int = 0,
|
||||
executable: str = None,
|
||||
stdin: _FILE = None,
|
||||
stdout: _FILE = None,
|
||||
stderr: _FILE = None,
|
||||
preexec_fn: Callable[[], Any] = None,
|
||||
close_fds: bool = False,
|
||||
shell: bool = False,
|
||||
cwd: str = None,
|
||||
env: Mapping[str, str] = None,
|
||||
universal_newlines: bool = False,
|
||||
startupinfo: Any = None,
|
||||
creationflags: int = 0) -> None: ...
|
||||
|
||||
def poll(self) -> int: ...
|
||||
def wait(self) -> int: ...
|
||||
# Return str/bytes
|
||||
def communicate(self, input: str = None) -> Tuple[str, str]: ...
|
||||
def send_signal(self, signal: int) -> None: ...
|
||||
def terminatate(self) -> None: ...
|
||||
def kill(self) -> None: ...
|
||||
def __enter__(self) -> 'Popen': ...
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
|
||||
def getstatusoutput(cmd: str) -> Tuple[int, str]: ...
|
||||
def getoutput(cmd: str) -> str: ...
|
||||
|
||||
# Windows-only: STARTUPINFO etc.
|
||||
|
||||
STD_INPUT_HANDLE = ... # type: Any
|
||||
STD_OUTPUT_HANDLE = ... # type: Any
|
||||
STD_ERROR_HANDLE = ... # type: Any
|
||||
SW_HIDE = ... # type: Any
|
||||
STARTF_USESTDHANDLES = ... # type: Any
|
||||
STARTF_USESHOWWINDOW = ... # type: Any
|
||||
CREATE_NEW_CONSOLE = ... # type: Any
|
||||
CREATE_NEW_PROCESS_GROUP = ... # type: Any
|
||||
@@ -0,0 +1,237 @@
|
||||
# Stubs for tarfile (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class TarError(Exception): ...
|
||||
class ExtractError(TarError): ...
|
||||
class ReadError(TarError): ...
|
||||
class CompressionError(TarError): ...
|
||||
class StreamError(TarError): ...
|
||||
class HeaderError(TarError): ...
|
||||
class EmptyHeaderError(HeaderError): ...
|
||||
class TruncatedHeaderError(HeaderError): ...
|
||||
class EOFHeaderError(HeaderError): ...
|
||||
class InvalidHeaderError(HeaderError): ...
|
||||
class SubsequentHeaderError(HeaderError): ...
|
||||
|
||||
class _LowLevelFile:
|
||||
fd = ... # type: Any
|
||||
def __init__(self, name, mode): ...
|
||||
def close(self): ...
|
||||
def read(self, size): ...
|
||||
def write(self, s): ...
|
||||
|
||||
class _Stream:
|
||||
name = ... # type: Any
|
||||
mode = ... # type: Any
|
||||
comptype = ... # type: Any
|
||||
fileobj = ... # type: Any
|
||||
bufsize = ... # type: Any
|
||||
buf = ... # type: Any
|
||||
pos = ... # type: Any
|
||||
closed = ... # type: Any
|
||||
zlib = ... # type: Any
|
||||
crc = ... # type: Any
|
||||
dbuf = ... # type: Any
|
||||
cmp = ... # type: Any
|
||||
def __init__(self, name, mode, comptype, fileobj, bufsize): ...
|
||||
def __del__(self): ...
|
||||
def write(self, s): ...
|
||||
def close(self): ...
|
||||
def tell(self): ...
|
||||
def seek(self, pos=0): ...
|
||||
def read(self, size=None): ...
|
||||
|
||||
class _StreamProxy:
|
||||
fileobj = ... # type: Any
|
||||
buf = ... # type: Any
|
||||
def __init__(self, fileobj): ...
|
||||
def read(self, size): ...
|
||||
def getcomptype(self): ...
|
||||
def close(self): ...
|
||||
|
||||
class _BZ2Proxy:
|
||||
blocksize = ... # type: Any
|
||||
fileobj = ... # type: Any
|
||||
mode = ... # type: Any
|
||||
name = ... # type: Any
|
||||
def __init__(self, fileobj, mode): ...
|
||||
pos = ... # type: Any
|
||||
bz2obj = ... # type: Any
|
||||
buf = ... # type: Any
|
||||
def init(self): ...
|
||||
def read(self, size): ...
|
||||
def seek(self, pos): ...
|
||||
def tell(self): ...
|
||||
def write(self, data): ...
|
||||
def close(self): ...
|
||||
|
||||
class _FileInFile:
|
||||
fileobj = ... # type: Any
|
||||
offset = ... # type: Any
|
||||
size = ... # type: Any
|
||||
sparse = ... # type: Any
|
||||
position = ... # type: Any
|
||||
def __init__(self, fileobj, offset, size, sparse=None): ...
|
||||
def tell(self): ...
|
||||
def seek(self, position): ...
|
||||
def read(self, size=None): ...
|
||||
def readnormal(self, size): ...
|
||||
def readsparse(self, size): ...
|
||||
def readsparsesection(self, size): ...
|
||||
|
||||
class ExFileObject:
|
||||
blocksize = ... # type: Any
|
||||
fileobj = ... # type: Any
|
||||
name = ... # type: Any
|
||||
mode = ... # type: Any
|
||||
closed = ... # type: Any
|
||||
size = ... # type: Any
|
||||
position = ... # type: Any
|
||||
buffer = ... # type: Any
|
||||
def __init__(self, tarfile, tarinfo): ...
|
||||
def read(self, size=None): ...
|
||||
def readline(self, size=-1): ...
|
||||
def readlines(self): ...
|
||||
def tell(self): ...
|
||||
def seek(self, pos, whence=...): ...
|
||||
def close(self): ...
|
||||
def __iter__(self): ...
|
||||
|
||||
class TarInfo:
|
||||
name = ... # type: Any
|
||||
mode = ... # type: Any
|
||||
uid = ... # type: Any
|
||||
gid = ... # type: Any
|
||||
size = ... # type: Any
|
||||
mtime = ... # type: Any
|
||||
chksum = ... # type: Any
|
||||
type = ... # type: Any
|
||||
linkname = ... # type: Any
|
||||
uname = ... # type: Any
|
||||
gname = ... # type: Any
|
||||
devmajor = ... # type: Any
|
||||
devminor = ... # type: Any
|
||||
offset = ... # type: Any
|
||||
offset_data = ... # type: Any
|
||||
pax_headers = ... # type: Any
|
||||
def __init__(self, name=''): ...
|
||||
path = ... # type: Any
|
||||
linkpath = ... # type: Any
|
||||
def get_info(self, encoding, errors): ...
|
||||
def tobuf(self, format=..., encoding=..., errors=''): ...
|
||||
def create_ustar_header(self, info): ...
|
||||
def create_gnu_header(self, info): ...
|
||||
def create_pax_header(self, info, encoding, errors): ...
|
||||
@classmethod
|
||||
def create_pax_global_header(cls, pax_headers): ...
|
||||
@classmethod
|
||||
def frombuf(cls, buf): ...
|
||||
@classmethod
|
||||
def fromtarfile(cls, tarfile): ...
|
||||
def isreg(self): ...
|
||||
def isfile(self): ...
|
||||
def isdir(self): ...
|
||||
def issym(self): ...
|
||||
def islnk(self): ...
|
||||
def ischr(self): ...
|
||||
def isblk(self): ...
|
||||
def isfifo(self): ...
|
||||
def issparse(self): ...
|
||||
def isdev(self): ...
|
||||
|
||||
class TarFile:
|
||||
debug = ... # type: Any
|
||||
dereference = ... # type: Any
|
||||
ignore_zeros = ... # type: Any
|
||||
errorlevel = ... # type: Any
|
||||
format = ... # type: Any
|
||||
encoding = ... # type: Any
|
||||
errors = ... # type: Any
|
||||
tarinfo = ... # type: Any
|
||||
fileobject = ... # type: Any
|
||||
mode = ... # type: Any
|
||||
name = ... # type: Any
|
||||
fileobj = ... # type: Any
|
||||
pax_headers = ... # type: Any
|
||||
closed = ... # type: Any
|
||||
members = ... # type: Any
|
||||
offset = ... # type: Any
|
||||
inodes = ... # type: Any
|
||||
firstmember = ... # type: Any
|
||||
def __init__(self, name=None, mode='', fileobj=None, format=None, tarinfo=None, dereference=None, ignore_zeros=None, encoding=None, errors=None, pax_headers=None, debug=None, errorlevel=None): ...
|
||||
posix = ... # type: Any
|
||||
@classmethod
|
||||
def open(cls, name=None, mode='', fileobj=None, bufsize=..., **kwargs): ...
|
||||
@classmethod
|
||||
def taropen(cls, name, mode='', fileobj=None, **kwargs): ...
|
||||
@classmethod
|
||||
def gzopen(cls, name, mode='', fileobj=None, compresslevel=9, **kwargs): ...
|
||||
@classmethod
|
||||
def bz2open(cls, name, mode='', fileobj=None, compresslevel=9, **kwargs): ...
|
||||
OPEN_METH = ... # type: Any
|
||||
def close(self): ...
|
||||
def getmember(self, name): ...
|
||||
def getmembers(self): ...
|
||||
def getnames(self): ...
|
||||
def gettarinfo(self, name=None, arcname=None, fileobj=None): ...
|
||||
def list(self, verbose=True): ...
|
||||
def add(self, name, arcname=None, recursive=True, exclude=None, filter=None): ...
|
||||
def addfile(self, tarinfo, fileobj=None): ...
|
||||
def extractall(self, path='', members=None): ...
|
||||
def extract(self, member, path=''): ...
|
||||
def extractfile(self, member): ...
|
||||
def makedir(self, tarinfo, targetpath): ...
|
||||
def makefile(self, tarinfo, targetpath): ...
|
||||
def makeunknown(self, tarinfo, targetpath): ...
|
||||
def makefifo(self, tarinfo, targetpath): ...
|
||||
def makedev(self, tarinfo, targetpath): ...
|
||||
def makelink(self, tarinfo, targetpath): ...
|
||||
def chown(self, tarinfo, targetpath): ...
|
||||
def chmod(self, tarinfo, targetpath): ...
|
||||
def utime(self, tarinfo, targetpath): ...
|
||||
def next(self): ...
|
||||
def __iter__(self): ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, type, value, traceback): ...
|
||||
|
||||
class TarIter:
|
||||
tarfile = ... # type: Any
|
||||
index = ... # type: Any
|
||||
def __init__(self, tarfile): ...
|
||||
def __iter__(self): ...
|
||||
def next(self): ...
|
||||
|
||||
class _section:
|
||||
offset = ... # type: Any
|
||||
size = ... # type: Any
|
||||
def __init__(self, offset, size): ...
|
||||
def __contains__(self, offset): ...
|
||||
|
||||
class _data(_section):
|
||||
realpos = ... # type: Any
|
||||
def __init__(self, offset, size, realpos): ...
|
||||
|
||||
class _hole(_section): ...
|
||||
|
||||
class _ringbuffer(list):
|
||||
idx = ... # type: Any
|
||||
def __init__(self): ...
|
||||
def find(self, offset): ...
|
||||
|
||||
class TarFileCompat:
|
||||
tarfile = ... # type: Any
|
||||
def __init__(self, file, mode='', compression=...): ...
|
||||
def namelist(self): ...
|
||||
def infolist(self): ...
|
||||
def printdir(self): ...
|
||||
def testzip(self): ...
|
||||
def getinfo(self, name): ...
|
||||
def read(self, name): ...
|
||||
def write(self, filename, arcname=None, compress_type=None): ...
|
||||
def writestr(self, zinfo, bytes): ...
|
||||
def close(self): ...
|
||||
|
||||
def is_tarfile(name): ...
|
||||
@@ -0,0 +1,42 @@
|
||||
# Stubs for tempfile
|
||||
# Ron Murawski <ron@horizonchess.com>
|
||||
|
||||
# based on http://docs.python.org/3.3/library/tempfile.html
|
||||
# Adapted for Python 2.7 by Michal Pokorny
|
||||
|
||||
from typing import Tuple, IO
|
||||
|
||||
# global variables
|
||||
tempdir = ''
|
||||
template = ''
|
||||
|
||||
# TODO text files
|
||||
|
||||
# function stubs
|
||||
def TemporaryFile(
|
||||
mode: str = 'w+b', bufsize: int = -1, suffix: str = '',
|
||||
prefix: str = 'tmp', dir: str = None) -> IO[str]: ...
|
||||
def NamedTemporaryFile(
|
||||
mode: str = 'w+b', bufsize: int = -1, suffix: str = '',
|
||||
prefix: str = 'tmp', dir: str = None, delete: bool = True
|
||||
) -> IO[str]: ...
|
||||
def SpooledTemporaryFile(
|
||||
max_size: int = 0, mode: str = 'w+b', buffering: int = -1,
|
||||
suffix: str = '', prefix: str = 'tmp', dir: str = None) -> IO[str]:
|
||||
...
|
||||
|
||||
class TemporaryDirectory:
|
||||
name = ''
|
||||
def __init__(self, suffix: str = '', prefix: str = 'tmp',
|
||||
dir: str = None) -> None: ...
|
||||
def cleanup(self) -> None: ...
|
||||
def __enter__(self) -> str: ...
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
|
||||
def mkstemp(suffix: str = '', prefix: str = 'tmp', dir: str = None,
|
||||
text: bool = False) -> Tuple[int, str]: ...
|
||||
def mkdtemp(suffix: str = '', prefix: str = 'tmp',
|
||||
dir: str = None) -> str: ...
|
||||
def mktemp(suffix: str = '', prefix: str = 'tmp', dir: str = None) -> str: ...
|
||||
def gettempdir() -> str: ...
|
||||
def gettempprefix() -> str: ...
|
||||
@@ -0,0 +1,33 @@
|
||||
# Stubs for textwrap (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class _unicode: ...
|
||||
|
||||
class TextWrapper:
|
||||
whitespace_trans = ... # type: Any
|
||||
unicode_whitespace_trans = ... # type: Any
|
||||
uspace = ... # type: Any
|
||||
wordsep_re = ... # type: Any
|
||||
wordsep_simple_re = ... # type: Any
|
||||
sentence_end_re = ... # type: Any
|
||||
width = ... # type: Any
|
||||
initial_indent = ... # type: Any
|
||||
subsequent_indent = ... # type: Any
|
||||
expand_tabs = ... # type: Any
|
||||
replace_whitespace = ... # type: Any
|
||||
fix_sentence_endings = ... # type: Any
|
||||
break_long_words = ... # type: Any
|
||||
drop_whitespace = ... # type: Any
|
||||
break_on_hyphens = ... # type: Any
|
||||
wordsep_re_uni = ... # type: Any
|
||||
wordsep_simple_re_uni = ... # type: Any
|
||||
def __init__(self, width=70, initial_indent='', subsequent_indent='', expand_tabs=True, replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, drop_whitespace=True, break_on_hyphens=True): ...
|
||||
def wrap(self, text): ...
|
||||
def fill(self, text): ...
|
||||
|
||||
def wrap(text, width=70, **kwargs): ...
|
||||
def fill(text, width=70, **kwargs): ...
|
||||
def dedent(text): ...
|
||||
@@ -0,0 +1,98 @@
|
||||
# Stubs for threading
|
||||
|
||||
from typing import Any, Dict, Optional, Callable, TypeVar, Union, List, Mapping
|
||||
|
||||
def active_count() -> int: ...
|
||||
def activeCount() -> int: ...
|
||||
|
||||
def current_thread() -> Thread: ...
|
||||
def currentThread() -> Thread: ...
|
||||
def enumerate() -> List[Thread]: ...
|
||||
|
||||
class Thread(object):
|
||||
name = ''
|
||||
ident = 0
|
||||
daemon = False
|
||||
|
||||
def __init__(self, group: Any = None, target: Any = None,
|
||||
name: str = None, args: tuple = (),
|
||||
kwargs: Dict[Any, Any] = {}) -> None: ...
|
||||
def start(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def join(self, timeout: float = None) -> None: ...
|
||||
def is_alive(self) -> bool: ...
|
||||
|
||||
# Legacy methods
|
||||
def isAlive(self) -> bool: ...
|
||||
def getName(self) -> str: ...
|
||||
def setName(self, name: str) -> None: ...
|
||||
def isDaemon(self) -> bool: ...
|
||||
def setDaemon(self, daemon: bool) -> None: ...
|
||||
|
||||
class Timer(object):
|
||||
def __init__(self, interval: float, function: Any,
|
||||
args: List[Any] = [],
|
||||
kwargs: Mapping[Any, Any] = {}) -> None: ...
|
||||
def cancel(self) -> None: ...
|
||||
def start(self) -> None: ...
|
||||
|
||||
# TODO: better type
|
||||
def settrace(func: Callable[[Any, str, Any], Any]) -> None: ...
|
||||
def setprofile(func: Any) -> None: ...
|
||||
def stack_size(size: int = 0) -> None: ...
|
||||
|
||||
class ThreadError(Exception):
|
||||
pass
|
||||
|
||||
class local(object):
|
||||
# TODO: allows arbitrary parameters...
|
||||
pass
|
||||
|
||||
class Event(object):
|
||||
def is_set(self) -> bool: ...
|
||||
def isSet(self) -> bool: ...
|
||||
def set(self) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
# TODO can it return None?
|
||||
def wait(self, timeout: float = None) -> bool: ...
|
||||
|
||||
class Lock(object):
|
||||
def acquire(self, blocking: bool = True) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
def locked(self) -> bool: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(self, *args): ...
|
||||
|
||||
class RLock(object):
|
||||
def acquire(self, blocking: int = 1) -> Optional[bool]: ...
|
||||
def release(self) -> None: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(self, *args): ...
|
||||
|
||||
class Semaphore(object):
|
||||
def acquire(self, blocking: bool = True) -> Optional[bool]: ...
|
||||
def release(self) -> None: ...
|
||||
def __init__(self, value: int = 1) -> None: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(self, *args): ...
|
||||
|
||||
class BoundedSemaphore(object):
|
||||
def acquire(self, blocking: bool = True) -> Optional[bool]: ...
|
||||
def release(self) -> None: ...
|
||||
def __init__(self, value: int = 1) -> None: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(self, *args): ...
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class Condition(object):
|
||||
def acquire(self, blocking: bool = True) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
def notify(self, n: int = 1) -> None: ...
|
||||
def notify_all(self) -> None: ...
|
||||
def notifyAll(self) -> None: ...
|
||||
def wait(self, timeout: float = None) -> bool: ...
|
||||
def wait_for(self, predicate: Callable[[], _T], timeout: float = None) -> Union[_T, bool]: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(self, *args): ...
|
||||
def __init__(self, lock: Lock = None) -> None: ...
|
||||
@@ -0,0 +1,16 @@
|
||||
from typing import Any, IO, AnyStr, Callable, Tuple, List
|
||||
from types import TracebackType, FrameType
|
||||
|
||||
def print_tb(traceback: TracebackType, limit: int = None, file: IO[str] = None) -> None: ...
|
||||
def print_exception(type: type, value: Exception, limit: int = None, file: IO[str] = None) -> None: ...
|
||||
def print_exc(limit: int = None, file: IO[str] = None) -> None: ...
|
||||
def format_exc(limit: int = None) -> None: ...
|
||||
def print_last(limit: int = None, file: IO[str] = None) -> None: ...
|
||||
def print_stack(f: FrameType, limit: int = None, file: IO[AnyStr] = None) -> None: ...
|
||||
def extract_tb(f: TracebackType, limit: int = None) -> List[Tuple[str, int, str, str]]: ...
|
||||
def extract_stack(f: FrameType = None, limit: int = None) -> None: ...
|
||||
def format_list(list: List[Tuple[str, int, str, str]]) -> str: ...
|
||||
def format_exception_only(type: type, value: List[str]) -> str: ...
|
||||
def format_tb(f: TracebackType, limit: int = None) -> str: ...
|
||||
def format_stack(f: FrameType = None, limit: int = None) -> str: ...
|
||||
def tb_lineno(tb: TracebackType) -> AnyStr: ...
|
||||
@@ -0,0 +1,20 @@
|
||||
# Stubs for types
|
||||
|
||||
from typing import Any
|
||||
|
||||
class ModuleType:
|
||||
__name__ = ... # type: str
|
||||
__file__ = ... # type: str
|
||||
def __init__(self, name: str, doc: Any) -> None: ...
|
||||
|
||||
class TracebackType:
|
||||
...
|
||||
|
||||
class FrameType:
|
||||
...
|
||||
|
||||
class GeneratorType:
|
||||
...
|
||||
|
||||
class ListType:
|
||||
...
|
||||
@@ -0,0 +1,299 @@
|
||||
# Stubs for typing (Python 2.7)
|
||||
|
||||
from abc import abstractmethod, ABCMeta
|
||||
|
||||
# Definitions of special type checking related constructs. Their definition
|
||||
# are not used, so their value does not matter.
|
||||
|
||||
cast = object()
|
||||
overload = object()
|
||||
Any = object()
|
||||
TypeVar = object()
|
||||
Generic = object()
|
||||
Tuple = object()
|
||||
Callable = object()
|
||||
builtinclass = object()
|
||||
_promote = object()
|
||||
NamedTuple = object()
|
||||
|
||||
# Type aliases
|
||||
|
||||
class TypeAlias:
|
||||
# Class for defining generic aliases for library types.
|
||||
def __init__(self, target_type): ...
|
||||
def __getitem__(self, typeargs): ...
|
||||
|
||||
Union = TypeAlias(object)
|
||||
Optional = TypeAlias(object)
|
||||
List = TypeAlias(object)
|
||||
Dict = TypeAlias(object)
|
||||
Set = TypeAlias(object)
|
||||
|
||||
# Predefined type variables.
|
||||
AnyStr = TypeVar('AnyStr', str, unicode)
|
||||
|
||||
# Abstract base classes.
|
||||
|
||||
# These type variables are used by the container types.
|
||||
_T = TypeVar('_T')
|
||||
_S = TypeVar('_S')
|
||||
_KT = TypeVar('_KT') # Key type.
|
||||
_VT = TypeVar('_VT') # Value type.
|
||||
_T_co = TypeVar('_T_co', covariant=True) # Any type covariant containers.
|
||||
_V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers.
|
||||
_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers.
|
||||
_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant.
|
||||
|
||||
# TODO Container etc.
|
||||
|
||||
class SupportsInt(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def __int__(self) -> int: ...
|
||||
|
||||
class SupportsFloat(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def __float__(self) -> float: ...
|
||||
|
||||
class SupportsAbs(Generic[_T]):
|
||||
@abstractmethod
|
||||
def __abs__(self) -> _T: ...
|
||||
|
||||
class SupportsRound(Generic[_T]):
|
||||
@abstractmethod
|
||||
def __round__(self, ndigits: int = 0) -> _T: ...
|
||||
|
||||
class Reversible(Generic[_T]):
|
||||
@abstractmethod
|
||||
def __reversed__(self) -> Iterator[_T]: ...
|
||||
|
||||
class Sized(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class Iterable(Generic[_T_co]):
|
||||
@abstractmethod
|
||||
def __iter__(self) -> Iterator[_T_co]: ...
|
||||
|
||||
class Iterator(Iterable[_T_co], Generic[_T_co]):
|
||||
@abstractmethod
|
||||
def next(self) -> _T_co: ...
|
||||
|
||||
class Sequence(Sized, Iterable[_T_co], Generic[_T_co]):
|
||||
@abstractmethod
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
def __getitem__(self, i: int) -> _T_co: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
def __getitem__(self, s: slice) -> Sequence[_T_co]: ...
|
||||
@abstractmethod
|
||||
def index(self, x: Any) -> int: ...
|
||||
@abstractmethod
|
||||
def count(self, x: Any) -> int: ...
|
||||
|
||||
class MutableSequence(Sequence[_T], Generic[_T]):
|
||||
@abstractmethod
|
||||
def insert(self, index: int, object: _T) -> None: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
def __setitem__(self, i: int, o: _T) -> None: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
def __setitem__(self, s: slice, o: Sequence[_T]) -> None: ...
|
||||
@abstractmethod
|
||||
def __delitem__(self, i: Union[int, slice]) -> None: ...
|
||||
# Mixin methods
|
||||
def append(self, object: _T) -> None: ...
|
||||
def extend(self, iterable: Iterable[_T]) -> None: ...
|
||||
def reverse(self) -> None: ...
|
||||
def pop(self, index: int = -1) -> _T: ...
|
||||
def remove(self, object: _T) -> None: ...
|
||||
def __iadd__(self, x: Iterable[_T]) -> MutableSequence[_T]: ...
|
||||
|
||||
class AbstractSet(Sized, Iterable[_T_co], Generic[_T_co]):
|
||||
@abstractmethod
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
# Mixin methods
|
||||
def __le__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __and__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ...
|
||||
def __or__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...
|
||||
def __sub__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ...
|
||||
def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...
|
||||
# TODO: argument can be any container?
|
||||
def isdisjoint(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def union(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...
|
||||
|
||||
class MutableSet(AbstractSet[_T], Generic[_T]):
|
||||
@abstractmethod
|
||||
def add(self, x: _T) -> None: ...
|
||||
@abstractmethod
|
||||
def discard(self, x: _T) -> None: ...
|
||||
# Mixin methods
|
||||
def clear(self) -> None: ...
|
||||
def pop(self) -> _T: ...
|
||||
def remove(self, element: _T) -> None: ...
|
||||
def __ior__(self, s: AbstractSet[_S]) -> MutableSet[Union[_T, _S]]: ...
|
||||
def __iand__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ...
|
||||
def __ixor__(self, s: AbstractSet[_S]) -> MutableSet[Union[_T, _S]]: ...
|
||||
def __isub__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ...
|
||||
|
||||
class Mapping(Sized, Iterable[_KT], Generic[_KT, _VT]):
|
||||
@abstractmethod
|
||||
def __getitem__(self, k: _KT) -> _VT: ...
|
||||
# Mixin methods
|
||||
def get(self, k: _KT, default: _VT = ...) -> _VT: ...
|
||||
def keys(self) -> list[_KT]: ...
|
||||
def values(self) -> list[_VT]: ...
|
||||
def items(self) -> list[Tuple[_KT, _VT]]: ...
|
||||
def iterkeys(self) -> Iterator[_KT]: ...
|
||||
def itervalues(self) -> Iterator[_VT]: ...
|
||||
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
|
||||
class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
@abstractmethod
|
||||
def __setitem__(self, k: _KT, v: _VT) -> None: ...
|
||||
@abstractmethod
|
||||
def __delitem__(self, v: _KT) -> None: ...
|
||||
|
||||
def clear(self) -> None: ...
|
||||
def pop(self, k: _KT, default: _VT = ...) -> _VT: ...
|
||||
def popitem(self) -> Tuple[_KT, _VT]: ...
|
||||
def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
|
||||
def update(self, m: Union[Mapping[_KT, _VT],
|
||||
Iterable[Tuple[_KT, _VT]]]) -> None: ...
|
||||
|
||||
class IO(Iterable[AnyStr], Generic[AnyStr]):
|
||||
# TODO detach
|
||||
# TODO use abstract properties
|
||||
@property
|
||||
def mode(self) -> str: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
@property
|
||||
def closed(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def fileno(self) -> int: ...
|
||||
@abstractmethod
|
||||
def flush(self) -> None: ...
|
||||
@abstractmethod
|
||||
def isatty(self) -> bool: ...
|
||||
# TODO what if n is None?
|
||||
@abstractmethod
|
||||
def read(self, n: int = -1) -> AnyStr: ...
|
||||
@abstractmethod
|
||||
def readable(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def readline(self, limit: int = -1) -> AnyStr: ...
|
||||
@abstractmethod
|
||||
def readlines(self, hint: int = -1) -> list[AnyStr]: ...
|
||||
@abstractmethod
|
||||
def seek(self, offset: int, whence: int = 0) -> None: ...
|
||||
@abstractmethod
|
||||
def seekable(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def tell(self) -> int: ...
|
||||
@abstractmethod
|
||||
def truncate(self, size: int = ...) -> int: ...
|
||||
@abstractmethod
|
||||
def writable(self) -> bool: ...
|
||||
# TODO buffer objects
|
||||
@abstractmethod
|
||||
def write(self, s: AnyStr) -> None: ...
|
||||
@abstractmethod
|
||||
def writelines(self, lines: Iterable[AnyStr]) -> None: ...
|
||||
|
||||
@abstractmethod
|
||||
def __iter__(self) -> Iterator[AnyStr]: ...
|
||||
@abstractmethod
|
||||
def __enter__(self) -> 'IO[AnyStr]': ...
|
||||
@abstractmethod
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
|
||||
class BinaryIO(IO[str]):
|
||||
# TODO readinto
|
||||
# TODO read1?
|
||||
# TODO peek?
|
||||
@abstractmethod
|
||||
def __enter__(self) -> BinaryIO: ...
|
||||
|
||||
class TextIO(IO[unicode]):
|
||||
# TODO use abstractproperty
|
||||
@property
|
||||
def buffer(self) -> BinaryIO: ...
|
||||
@property
|
||||
def encoding(self) -> str: ...
|
||||
@property
|
||||
def errors(self) -> str: ...
|
||||
@property
|
||||
def line_buffering(self) -> bool: ...
|
||||
@property
|
||||
def newlines(self) -> Any: ... # None, str or tuple
|
||||
@abstractmethod
|
||||
def __enter__(self) -> TextIO: ...
|
||||
|
||||
class Match(Generic[AnyStr]):
|
||||
pos = 0
|
||||
endpos = 0
|
||||
lastindex = 0
|
||||
lastgroup = None # type: AnyStr
|
||||
string = None # type: AnyStr
|
||||
|
||||
# The regular expression object whose match() or search() method produced
|
||||
# this match instance.
|
||||
re = None # type: 'Pattern[AnyStr]'
|
||||
|
||||
def expand(self, template: AnyStr) -> AnyStr: ...
|
||||
|
||||
@overload
|
||||
def group(self, group1: int = 0) -> AnyStr: ...
|
||||
@overload
|
||||
def group(self, group1: str) -> AnyStr: ...
|
||||
@overload
|
||||
def group(self, group1: int, group2: int,
|
||||
*groups: int) -> Sequence[AnyStr]: ...
|
||||
@overload
|
||||
def group(self, group1: str, group2: str,
|
||||
*groups: str) -> Sequence[AnyStr]: ...
|
||||
|
||||
def groups(self, default: AnyStr = None) -> Sequence[AnyStr]: ...
|
||||
def groupdict(self, default: AnyStr = None) -> dict[str, AnyStr]: ...
|
||||
def start(self, group: int = 0) -> int: ...
|
||||
def end(self, group: int = 0) -> int: ...
|
||||
def span(self, group: int = 0) -> Tuple[int, int]: ...
|
||||
|
||||
class Pattern(Generic[AnyStr]):
|
||||
flags = 0
|
||||
groupindex = 0
|
||||
groups = 0
|
||||
pattern = None # type: AnyStr
|
||||
|
||||
def search(self, string: AnyStr, pos: int = 0,
|
||||
endpos: int = -1) -> Match[AnyStr]: ...
|
||||
def match(self, string: AnyStr, pos: int = 0,
|
||||
endpos: int = -1) -> Match[AnyStr]: ...
|
||||
def split(self, string: AnyStr, maxsplit: int = 0) -> list[AnyStr]: ...
|
||||
def findall(self, string: AnyStr, pos: int = 0,
|
||||
endpos: int = -1) -> list[AnyStr]: ...
|
||||
def finditer(self, string: AnyStr, pos: int = 0,
|
||||
endpos: int = -1) -> Iterator[Match[AnyStr]]: ...
|
||||
|
||||
@overload
|
||||
def sub(self, repl: AnyStr, string: AnyStr,
|
||||
count: int = 0) -> AnyStr: ...
|
||||
@overload
|
||||
def sub(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr,
|
||||
count: int = 0) -> AnyStr: ...
|
||||
|
||||
@overload
|
||||
def subn(self, repl: AnyStr, string: AnyStr,
|
||||
count: int = 0) -> Tuple[AnyStr, int]: ...
|
||||
@overload
|
||||
def subn(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr,
|
||||
count: int = 0) -> Tuple[AnyStr, int]: ...
|
||||
@@ -0,0 +1,134 @@
|
||||
# Stubs for urllib (Python 2)
|
||||
# NOTE: This dynamically typed stub was originally automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Mapping, Union, Tuple, Sequence, IO
|
||||
|
||||
def url2pathname(pathname: str) -> str: ...
|
||||
def pathname2url(pathname: str) -> str: ...
|
||||
def urlopen(url: str, data=None, proxies: Mapping[str, str] = None, context=None) -> IO[Any]: ...
|
||||
def urlretrieve(url, filename=None, reporthook=None, data=None, context=None): ...
|
||||
def urlcleanup() -> None: ...
|
||||
|
||||
class ContentTooShortError(IOError):
|
||||
content = ... # type: Any
|
||||
def __init__(self, message, content): ...
|
||||
|
||||
class URLopener:
|
||||
version = ... # type: Any
|
||||
proxies = ... # type: Any
|
||||
key_file = ... # type: Any
|
||||
cert_file = ... # type: Any
|
||||
context = ... # type: Any
|
||||
addheaders = ... # type: Any
|
||||
tempcache = ... # type: Any
|
||||
ftpcache = ... # type: Any
|
||||
def __init__(self, proxies: Mapping[str, str] = None, context=None, **x509) -> None: ...
|
||||
def __del__(self): ...
|
||||
def close(self): ...
|
||||
def cleanup(self): ...
|
||||
def addheader(self, *args): ...
|
||||
type = ... # type: Any
|
||||
def open(self, fullurl: str, data=None): ...
|
||||
def open_unknown(self, fullurl, data=None): ...
|
||||
def open_unknown_proxy(self, proxy, fullurl, data=None): ...
|
||||
def retrieve(self, url, filename=None, reporthook=None, data=None): ...
|
||||
def open_http(self, url, data=None): ...
|
||||
def http_error(self, url, fp, errcode, errmsg, headers, data=None): ...
|
||||
def http_error_default(self, url, fp, errcode, errmsg, headers): ...
|
||||
def open_https(self, url, data=None): ...
|
||||
def open_file(self, url): ...
|
||||
def open_local_file(self, url): ...
|
||||
def open_ftp(self, url): ...
|
||||
def open_data(self, url, data=None): ...
|
||||
|
||||
class FancyURLopener(URLopener):
|
||||
auth_cache = ... # type: Any
|
||||
tries = ... # type: Any
|
||||
maxtries = ... # type: Any
|
||||
def __init__(self, *args, **kwargs): ...
|
||||
def http_error_default(self, url, fp, errcode, errmsg, headers): ...
|
||||
def http_error_302(self, url, fp, errcode, errmsg, headers, data=None): ...
|
||||
def redirect_internal(self, url, fp, errcode, errmsg, headers, data): ...
|
||||
def http_error_301(self, url, fp, errcode, errmsg, headers, data=None): ...
|
||||
def http_error_303(self, url, fp, errcode, errmsg, headers, data=None): ...
|
||||
def http_error_307(self, url, fp, errcode, errmsg, headers, data=None): ...
|
||||
def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): ...
|
||||
def http_error_407(self, url, fp, errcode, errmsg, headers, data=None): ...
|
||||
def retry_proxy_http_basic_auth(self, url, realm, data=None): ...
|
||||
def retry_proxy_https_basic_auth(self, url, realm, data=None): ...
|
||||
def retry_http_basic_auth(self, url, realm, data=None): ...
|
||||
def retry_https_basic_auth(self, url, realm, data=None): ...
|
||||
def get_user_passwd(self, host, realm, clear_cache=0): ...
|
||||
def prompt_user_passwd(self, host, realm): ...
|
||||
|
||||
class ftpwrapper:
|
||||
user = ... # type: Any
|
||||
passwd = ... # type: Any
|
||||
host = ... # type: Any
|
||||
port = ... # type: Any
|
||||
dirs = ... # type: Any
|
||||
timeout = ... # type: Any
|
||||
refcount = ... # type: Any
|
||||
keepalive = ... # type: Any
|
||||
def __init__(self, user, passwd, host, port, dirs, timeout=..., persistent=True): ...
|
||||
busy = ... # type: Any
|
||||
ftp = ... # type: Any
|
||||
def init(self): ...
|
||||
def retrfile(self, file, type): ...
|
||||
def endtransfer(self): ...
|
||||
def close(self): ...
|
||||
def file_close(self): ...
|
||||
def real_close(self): ...
|
||||
|
||||
class addbase:
|
||||
fp = ... # type: Any
|
||||
read = ... # type: Any
|
||||
readline = ... # type: Any
|
||||
readlines = ... # type: Any
|
||||
fileno = ... # type: Any
|
||||
__iter__ = ... # type: Any
|
||||
next = ... # type: Any
|
||||
def __init__(self, fp): ...
|
||||
def close(self): ...
|
||||
|
||||
class addclosehook(addbase):
|
||||
closehook = ... # type: Any
|
||||
hookargs = ... # type: Any
|
||||
def __init__(self, fp, closehook, *hookargs): ...
|
||||
def close(self): ...
|
||||
|
||||
class addinfo(addbase):
|
||||
headers = ... # type: Any
|
||||
def __init__(self, fp, headers): ...
|
||||
def info(self): ...
|
||||
|
||||
class addinfourl(addbase):
|
||||
headers = ... # type: Any
|
||||
url = ... # type: Any
|
||||
code = ... # type: Any
|
||||
def __init__(self, fp, headers, url, code=None): ...
|
||||
def info(self): ...
|
||||
def getcode(self): ...
|
||||
def geturl(self): ...
|
||||
|
||||
def unwrap(url): ...
|
||||
def splittype(url): ...
|
||||
def splithost(url): ...
|
||||
def splituser(host): ...
|
||||
def splitpasswd(user): ...
|
||||
def splitport(host): ...
|
||||
def splitnport(host, defport=-1): ...
|
||||
def splitquery(url): ...
|
||||
def splittag(url): ...
|
||||
def splitattr(url): ...
|
||||
def splitvalue(attr): ...
|
||||
def unquote(s: str) -> str: ...
|
||||
def unquote_plus(s: str) -> str: ...
|
||||
def quote(s: str, safe='') -> str: ...
|
||||
def quote_plus(s: str, safe='') -> str: ...
|
||||
def urlencode(query: Union[Sequence[Tuple[Any, Any]], Mapping[Any, Any]], doseq=0) -> str: ...
|
||||
|
||||
def getproxies() -> Mapping[str, str]: ... # type: Any
|
||||
|
||||
# Names in __all__ with no definition:
|
||||
# basejoin
|
||||
@@ -0,0 +1,47 @@
|
||||
# Stubs for urlparse (Python 2)
|
||||
|
||||
from typing import List, NamedTuple, Tuple
|
||||
|
||||
uses_relative = [] # type: List[str]
|
||||
uses_netloc = [] # type: List[str]
|
||||
uses_params = [] # type: List[str]
|
||||
non_hierarchical = [] # type: List[str]
|
||||
uses_query = [] # type: List[str]
|
||||
uses_fragment = [] # type: List[str]
|
||||
scheme_chars = ''
|
||||
MAX_CACHE_SIZE = 0
|
||||
|
||||
def clear_cache() -> None: ...
|
||||
|
||||
class ResultMixin(object):
|
||||
@property
|
||||
def username(self) -> str: ...
|
||||
@property
|
||||
def password(self) -> str: ...
|
||||
@property
|
||||
def hostname(self) -> str: ...
|
||||
@property
|
||||
def port(self) -> int: ...
|
||||
|
||||
class SplitResult(NamedTuple('SplitResult', [
|
||||
('scheme', str), ('netloc', str), ('path', str), ('query', str), ('fragment', str)
|
||||
]), ResultMixin):
|
||||
def geturl(self) -> str: ...
|
||||
|
||||
class ParseResult(NamedTuple('ParseResult', [
|
||||
('scheme', str), ('netloc', str), ('path', str), ('params', str), ('query', str),
|
||||
('fragment', str)
|
||||
]), ResultMixin):
|
||||
def geturl(self) -> str: ...
|
||||
|
||||
def urlparse(url: str, scheme: str = '', allow_fragments: bool = True) -> ParseResult: ...
|
||||
def urlsplit(url: str, scheme: str = '', allow_fragments: bool = True) -> SplitResult: ...
|
||||
def urlunparse(data: Tuple[str, str, str, str, str, str]) -> str: ...
|
||||
def urlunsplit(data: Tuple[str, str, str, str, str]) -> str: ...
|
||||
def urljoin(base: str, url: str, allow_fragments: bool = True) -> str: ...
|
||||
def urldefrag(url: str) -> str: ...
|
||||
def unquote(s: str) -> str: ...
|
||||
def parse_qs(qs: str, keep_blank_values: bool = ...,
|
||||
strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
|
||||
def parse_qsl(qs: str, keep_blank_values: int = ...,
|
||||
strict_parsing: bool = ...) -> List[Tuple[str, str]]: ...
|
||||
@@ -0,0 +1,36 @@
|
||||
from typing import NamedTuple, Any, Tuple
|
||||
|
||||
_int_type = int
|
||||
|
||||
class _UUIDFields(NamedTuple('_UUIDFields',
|
||||
[('time_low', int), ('time_mid', int), ('time_hi_version', int), ('clock_seq_hi_variant', int), ('clock_seq_low', int), ('node', int)])):
|
||||
time = ... # type: int
|
||||
clock_seq = ... # type: int
|
||||
|
||||
class UUID:
|
||||
def __init__(self, hex: str = None, bytes: str = None, bytes_le: str = None,
|
||||
fields: Tuple[int, int, int, int, int, int] = None, int: int = None, version: Any = None) -> None: ...
|
||||
bytes = ... # type: str
|
||||
bytes_le = ... # type: str
|
||||
fields = ... # type: _UUIDFields
|
||||
hex = ... # type: str
|
||||
int = ... # type: _int_type
|
||||
urn = ... # type: str
|
||||
variant = ... # type: _int_type
|
||||
version = ... # type: _int_type
|
||||
|
||||
RESERVED_NCS = ... # type: int
|
||||
RFC_4122 = ... # type: int
|
||||
RESERVED_MICROSOFT = ... # type: int
|
||||
RESERVED_FUTURE = ... # type: int
|
||||
|
||||
def getnode() -> int: ...
|
||||
def uuid1(node: int = None, clock_seq: int = None) -> UUID: ...
|
||||
def uuid3(namespace: UUID, name: str) -> UUID: ...
|
||||
def uuid4() -> UUID: ...
|
||||
def uuid5(namespace: UUID, name: str) -> UUID: ...
|
||||
|
||||
NAMESPACE_DNS = ... # type: str
|
||||
NAMESPACE_URL = ... # type: str
|
||||
NAMESPACE_OID = ... # type: str
|
||||
NAMESPACE_X500 = ... # type: str
|
||||
@@ -0,0 +1,50 @@
|
||||
# Stubs for xml.sax.handler (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
version = ... # type: Any
|
||||
|
||||
class ErrorHandler:
|
||||
def error(self, exception): ...
|
||||
def fatalError(self, exception): ...
|
||||
def warning(self, exception): ...
|
||||
|
||||
class ContentHandler:
|
||||
def __init__(self): ...
|
||||
def setDocumentLocator(self, locator): ...
|
||||
def startDocument(self): ...
|
||||
def endDocument(self): ...
|
||||
def startPrefixMapping(self, prefix, uri): ...
|
||||
def endPrefixMapping(self, prefix): ...
|
||||
def startElement(self, name, attrs): ...
|
||||
def endElement(self, name): ...
|
||||
def startElementNS(self, name, qname, attrs): ...
|
||||
def endElementNS(self, name, qname): ...
|
||||
def characters(self, content): ...
|
||||
def ignorableWhitespace(self, whitespace): ...
|
||||
def processingInstruction(self, target, data): ...
|
||||
def skippedEntity(self, name): ...
|
||||
|
||||
class DTDHandler:
|
||||
def notationDecl(self, name, publicId, systemId): ...
|
||||
def unparsedEntityDecl(self, name, publicId, systemId, ndata): ...
|
||||
|
||||
class EntityResolver:
|
||||
def resolveEntity(self, publicId, systemId): ...
|
||||
|
||||
feature_namespaces = ... # type: Any
|
||||
feature_namespace_prefixes = ... # type: Any
|
||||
feature_string_interning = ... # type: Any
|
||||
feature_validation = ... # type: Any
|
||||
feature_external_ges = ... # type: Any
|
||||
feature_external_pes = ... # type: Any
|
||||
all_features = ... # type: Any
|
||||
property_lexical_handler = ... # type: Any
|
||||
property_declaration_handler = ... # type: Any
|
||||
property_dom_node = ... # type: Any
|
||||
property_xml_string = ... # type: Any
|
||||
property_encoding = ... # type: Any
|
||||
property_interning_dict = ... # type: Any
|
||||
all_properties = ... # type: Any
|
||||
@@ -0,0 +1,58 @@
|
||||
# Stubs for xml.sax.saxutils (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Mapping
|
||||
|
||||
from xml.sax import handler
|
||||
from xml.sax import xmlreader
|
||||
|
||||
def escape(data: str, entities: Mapping[str, str] = None) -> str: ...
|
||||
def unescape(data: str, entities: Mapping[str, str] = None) -> str: ...
|
||||
def quoteattr(data: str, entities: Mapping[str, str] = None) -> str: ...
|
||||
|
||||
class XMLGenerator(handler.ContentHandler):
|
||||
def __init__(self, out=None, encoding=''): ...
|
||||
def startDocument(self): ...
|
||||
def endDocument(self): ...
|
||||
def startPrefixMapping(self, prefix, uri): ...
|
||||
def endPrefixMapping(self, prefix): ...
|
||||
def startElement(self, name, attrs): ...
|
||||
def endElement(self, name): ...
|
||||
def startElementNS(self, name, qname, attrs): ...
|
||||
def endElementNS(self, name, qname): ...
|
||||
def characters(self, content): ...
|
||||
def ignorableWhitespace(self, content): ...
|
||||
def processingInstruction(self, target, data): ...
|
||||
|
||||
class XMLFilterBase(xmlreader.XMLReader):
|
||||
def __init__(self, parent=None): ...
|
||||
def error(self, exception): ...
|
||||
def fatalError(self, exception): ...
|
||||
def warning(self, exception): ...
|
||||
def setDocumentLocator(self, locator): ...
|
||||
def startDocument(self): ...
|
||||
def endDocument(self): ...
|
||||
def startPrefixMapping(self, prefix, uri): ...
|
||||
def endPrefixMapping(self, prefix): ...
|
||||
def startElement(self, name, attrs): ...
|
||||
def endElement(self, name): ...
|
||||
def startElementNS(self, name, qname, attrs): ...
|
||||
def endElementNS(self, name, qname): ...
|
||||
def characters(self, content): ...
|
||||
def ignorableWhitespace(self, chars): ...
|
||||
def processingInstruction(self, target, data): ...
|
||||
def skippedEntity(self, name): ...
|
||||
def notationDecl(self, name, publicId, systemId): ...
|
||||
def unparsedEntityDecl(self, name, publicId, systemId, ndata): ...
|
||||
def resolveEntity(self, publicId, systemId): ...
|
||||
def parse(self, source): ...
|
||||
def setLocale(self, locale): ...
|
||||
def getFeature(self, name): ...
|
||||
def setFeature(self, name, state): ...
|
||||
def getProperty(self, name): ...
|
||||
def setProperty(self, name, value): ...
|
||||
def getParent(self): ...
|
||||
def setParent(self, parent): ...
|
||||
|
||||
def prepare_input_source(source, base=''): ...
|
||||
@@ -0,0 +1,75 @@
|
||||
# Stubs for xml.sax.xmlreader (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
class XMLReader:
|
||||
def __init__(self): ...
|
||||
def parse(self, source): ...
|
||||
def getContentHandler(self): ...
|
||||
def setContentHandler(self, handler): ...
|
||||
def getDTDHandler(self): ...
|
||||
def setDTDHandler(self, handler): ...
|
||||
def getEntityResolver(self): ...
|
||||
def setEntityResolver(self, resolver): ...
|
||||
def getErrorHandler(self): ...
|
||||
def setErrorHandler(self, handler): ...
|
||||
def setLocale(self, locale): ...
|
||||
def getFeature(self, name): ...
|
||||
def setFeature(self, name, state): ...
|
||||
def getProperty(self, name): ...
|
||||
def setProperty(self, name, value): ...
|
||||
|
||||
class IncrementalParser(XMLReader):
|
||||
def __init__(self, bufsize=...): ...
|
||||
def parse(self, source): ...
|
||||
def feed(self, data): ...
|
||||
def prepareParser(self, source): ...
|
||||
def close(self): ...
|
||||
def reset(self): ...
|
||||
|
||||
class Locator:
|
||||
def getColumnNumber(self): ...
|
||||
def getLineNumber(self): ...
|
||||
def getPublicId(self): ...
|
||||
def getSystemId(self): ...
|
||||
|
||||
class InputSource:
|
||||
def __init__(self, system_id=None): ...
|
||||
def setPublicId(self, public_id): ...
|
||||
def getPublicId(self): ...
|
||||
def setSystemId(self, system_id): ...
|
||||
def getSystemId(self): ...
|
||||
def setEncoding(self, encoding): ...
|
||||
def getEncoding(self): ...
|
||||
def setByteStream(self, bytefile): ...
|
||||
def getByteStream(self): ...
|
||||
def setCharacterStream(self, charfile): ...
|
||||
def getCharacterStream(self): ...
|
||||
|
||||
class AttributesImpl:
|
||||
def __init__(self, attrs): ...
|
||||
def getLength(self): ...
|
||||
def getType(self, name): ...
|
||||
def getValue(self, name): ...
|
||||
def getValueByQName(self, name): ...
|
||||
def getNameByQName(self, name): ...
|
||||
def getQNameByName(self, name): ...
|
||||
def getNames(self): ...
|
||||
def getQNames(self): ...
|
||||
def __len__(self): ...
|
||||
def __getitem__(self, name): ...
|
||||
def keys(self): ...
|
||||
def has_key(self, name): ...
|
||||
def __contains__(self, name): ...
|
||||
def get(self, name, alternative=None): ...
|
||||
def copy(self): ...
|
||||
def items(self): ...
|
||||
def values(self): ...
|
||||
|
||||
class AttributesNSImpl(AttributesImpl):
|
||||
def __init__(self, attrs, qnames): ...
|
||||
def getValueByQName(self, name): ...
|
||||
def getNameByQName(self, name): ...
|
||||
def getQNameByName(self, name): ...
|
||||
def getQNames(self): ...
|
||||
def copy(self): ...
|
||||
@@ -0,0 +1,200 @@
|
||||
# Stubs for ipaddress (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
IPV4LENGTH = ... # type: Any
|
||||
IPV6LENGTH = ... # type: Any
|
||||
|
||||
class AddressValueError(ValueError): ...
|
||||
class NetmaskValueError(ValueError): ...
|
||||
|
||||
def ip_address(address): ...
|
||||
def ip_network(address, strict=True): ...
|
||||
def ip_interface(address): ...
|
||||
def v4_int_to_packed(address): ...
|
||||
def v6_int_to_packed(address): ...
|
||||
def summarize_address_range(first, last): ...
|
||||
def collapse_addresses(addresses): ...
|
||||
def get_mixed_type_key(obj): ...
|
||||
|
||||
class _TotalOrderingMixin:
|
||||
def __eq__(self, other): ...
|
||||
def __ne__(self, other): ...
|
||||
def __lt__(self, other): ...
|
||||
def __le__(self, other): ...
|
||||
def __gt__(self, other): ...
|
||||
def __ge__(self, other): ...
|
||||
|
||||
class _IPAddressBase(_TotalOrderingMixin):
|
||||
@property
|
||||
def exploded(self): ...
|
||||
@property
|
||||
def compressed(self): ...
|
||||
@property
|
||||
def version(self): ...
|
||||
|
||||
class _BaseAddress(_IPAddressBase):
|
||||
def __init__(self, address): ...
|
||||
def __int__(self): ...
|
||||
def __eq__(self, other): ...
|
||||
def __lt__(self, other): ...
|
||||
def __add__(self, other): ...
|
||||
def __sub__(self, other): ...
|
||||
def __hash__(self): ...
|
||||
|
||||
class _BaseNetwork(_IPAddressBase):
|
||||
def __init__(self, address): ...
|
||||
def hosts(self): ...
|
||||
def __iter__(self): ...
|
||||
def __getitem__(self, n): ...
|
||||
def __lt__(self, other): ...
|
||||
def __eq__(self, other): ...
|
||||
def __hash__(self): ...
|
||||
def __contains__(self, other): ...
|
||||
def overlaps(self, other): ...
|
||||
@property
|
||||
def broadcast_address(self): ...
|
||||
@property
|
||||
def hostmask(self): ...
|
||||
@property
|
||||
def with_prefixlen(self): ...
|
||||
@property
|
||||
def with_netmask(self): ...
|
||||
@property
|
||||
def with_hostmask(self): ...
|
||||
@property
|
||||
def num_addresses(self): ...
|
||||
@property
|
||||
def prefixlen(self): ...
|
||||
def address_exclude(self, other): ...
|
||||
def compare_networks(self, other): ...
|
||||
def subnets(self, prefixlen_diff=1, new_prefix=None): ...
|
||||
def supernet(self, prefixlen_diff=1, new_prefix=None): ...
|
||||
@property
|
||||
def is_multicast(self): ...
|
||||
@property
|
||||
def is_reserved(self): ...
|
||||
@property
|
||||
def is_link_local(self): ...
|
||||
@property
|
||||
def is_private(self): ...
|
||||
@property
|
||||
def is_global(self): ...
|
||||
@property
|
||||
def is_unspecified(self): ...
|
||||
@property
|
||||
def is_loopback(self): ...
|
||||
|
||||
class _BaseV4:
|
||||
def __init__(self, address): ...
|
||||
@property
|
||||
def max_prefixlen(self): ...
|
||||
@property
|
||||
def version(self): ...
|
||||
|
||||
class IPv4Address(_BaseV4, _BaseAddress):
|
||||
def __init__(self, address): ...
|
||||
@property
|
||||
def packed(self): ...
|
||||
@property
|
||||
def is_reserved(self): ...
|
||||
@property
|
||||
def is_private(self): ...
|
||||
@property
|
||||
def is_multicast(self): ...
|
||||
@property
|
||||
def is_unspecified(self): ...
|
||||
@property
|
||||
def is_loopback(self): ...
|
||||
@property
|
||||
def is_link_local(self): ...
|
||||
|
||||
class IPv4Interface(IPv4Address):
|
||||
network = ... # type: Any
|
||||
netmask = ... # type: Any
|
||||
hostmask = ... # type: Any
|
||||
def __init__(self, address): ...
|
||||
def __eq__(self, other): ...
|
||||
def __lt__(self, other): ...
|
||||
def __hash__(self): ...
|
||||
@property
|
||||
def ip(self): ...
|
||||
@property
|
||||
def with_prefixlen(self): ...
|
||||
@property
|
||||
def with_netmask(self): ...
|
||||
@property
|
||||
def with_hostmask(self): ...
|
||||
|
||||
class IPv4Network(_BaseV4, _BaseNetwork):
|
||||
network_address = ... # type: Any
|
||||
netmask = ... # type: Any
|
||||
hosts = ... # type: Any
|
||||
def __init__(self, address, strict=True): ...
|
||||
@property
|
||||
def is_global(self): ...
|
||||
|
||||
class _BaseV6:
|
||||
def __init__(self, address): ...
|
||||
@property
|
||||
def max_prefixlen(self): ...
|
||||
@property
|
||||
def version(self): ...
|
||||
|
||||
class IPv6Address(_BaseV6, _BaseAddress):
|
||||
def __init__(self, address): ...
|
||||
@property
|
||||
def packed(self): ...
|
||||
@property
|
||||
def is_multicast(self): ...
|
||||
@property
|
||||
def is_reserved(self): ...
|
||||
@property
|
||||
def is_link_local(self): ...
|
||||
@property
|
||||
def is_site_local(self): ...
|
||||
@property
|
||||
def is_private(self): ...
|
||||
@property
|
||||
def is_global(self): ...
|
||||
@property
|
||||
def is_unspecified(self): ...
|
||||
@property
|
||||
def is_loopback(self): ...
|
||||
@property
|
||||
def ipv4_mapped(self): ...
|
||||
@property
|
||||
def teredo(self): ...
|
||||
@property
|
||||
def sixtofour(self): ...
|
||||
|
||||
class IPv6Interface(IPv6Address):
|
||||
network = ... # type: Any
|
||||
netmask = ... # type: Any
|
||||
hostmask = ... # type: Any
|
||||
def __init__(self, address): ...
|
||||
def __eq__(self, other): ...
|
||||
def __lt__(self, other): ...
|
||||
def __hash__(self): ...
|
||||
@property
|
||||
def ip(self): ...
|
||||
@property
|
||||
def with_prefixlen(self): ...
|
||||
@property
|
||||
def with_netmask(self): ...
|
||||
@property
|
||||
def with_hostmask(self): ...
|
||||
@property
|
||||
def is_unspecified(self): ...
|
||||
@property
|
||||
def is_loopback(self): ...
|
||||
|
||||
class IPv6Network(_BaseV6, _BaseNetwork):
|
||||
network_address = ... # type: Any
|
||||
netmask = ... # type: Any
|
||||
def __init__(self, address, strict=True): ...
|
||||
def hosts(self): ...
|
||||
@property
|
||||
def is_site_local(self): ...
|
||||
@@ -0,0 +1,13 @@
|
||||
"""The asyncio package, tracking PEP 3156."""
|
||||
from asyncio.futures import Future
|
||||
from asyncio.tasks import (coroutine, sleep, Task, FIRST_COMPLETED,
|
||||
FIRST_EXCEPTION, ALL_COMPLETED, wait, wait_for)
|
||||
from asyncio.events import (AbstractEventLoopPolicy, AbstractEventLoop,
|
||||
Handle, get_event_loop)
|
||||
from asyncio.queues import (Queue, PriorityQueue, LifoQueue, JoinableQueue,
|
||||
QueueFull, QueueEmpty)
|
||||
|
||||
__all__ = (futures.__all__ +
|
||||
tasks.__all__ +
|
||||
events.__all__ +
|
||||
queues.__all__)
|
||||
@@ -0,0 +1,172 @@
|
||||
from typing import Any, TypeVar, List, Callable, Tuple, Union, Dict
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from asyncio.futures import Future
|
||||
|
||||
# __all__ = ['AbstractServer',
|
||||
# 'TimerHandle',
|
||||
# 'get_event_loop_policy', 'set_event_loop_policy',
|
||||
# 'set_event_loop', 'new_event_loop',
|
||||
# 'get_child_watcher', 'set_child_watcher',
|
||||
# ]
|
||||
|
||||
|
||||
__all__ = ['AbstractEventLoopPolicy', 'AbstractEventLoop', 'Handle', 'get_event_loop']
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
PIPE = ... # type: Any # from subprocess.PIPE
|
||||
|
||||
AF_UNSPEC = 0 # from socket
|
||||
AI_PASSIVE = 0
|
||||
|
||||
class Handle:
|
||||
__slots__ = [] # type: List[str]
|
||||
_cancelled = False
|
||||
_args = [] # type: List[Any]
|
||||
def __init__(self, callback: Callable[[],Any], args: List[Any],
|
||||
loop: AbstractEventLoop) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def cancel(self) -> None: ...
|
||||
def _run(self) -> None: ...
|
||||
|
||||
|
||||
class AbstractEventLoop(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def run_forever(self) -> None: ...
|
||||
@abstractmethod
|
||||
def run_until_complete(self, future: Future[_T]) -> _T: ...
|
||||
@abstractmethod
|
||||
def stop(self) -> None: ...
|
||||
@abstractmethod
|
||||
def is_running(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
# Methods scheduling callbacks. All these return Handles.
|
||||
@abstractmethod
|
||||
def call_soon(self, callback: Callable[[],Any], *args: Any) -> Handle: ...
|
||||
@abstractmethod
|
||||
def call_later(self, delay: Union[int, float], callback: Callable[[],Any], *args: Any) -> Handle: ...
|
||||
@abstractmethod
|
||||
def call_at(self, when: float, callback: Callable[[],Any], *args: Any) -> Handle: ...
|
||||
@abstractmethod
|
||||
def time(self) -> float: ...
|
||||
# Methods for interacting with threads
|
||||
@abstractmethod
|
||||
def call_soon_threadsafe(self, callback: Callable[[],Any], *args: Any) -> Handle: ...
|
||||
@abstractmethod
|
||||
def run_in_executor(self, executor: Any,
|
||||
callback: Callable[[],Any], *args: Any) -> Future[Any]: ...
|
||||
@abstractmethod
|
||||
def set_default_executor(self, executor: Any) -> None: ...
|
||||
# Network I/O methods returning Futures.
|
||||
@abstractmethod
|
||||
def getaddrinfo(self, host: str, port: int, *,
|
||||
family: int = 0, type: int = 0, proto: int = 0, flags: int = 0) -> List[Tuple[int, int, int, str, tuple]]: ...
|
||||
@abstractmethod
|
||||
def getnameinfo(self, sockaddr: tuple, flags: int = 0) -> Tuple[str, int]: ...
|
||||
@abstractmethod
|
||||
def create_connection(self, protocol_factory: Any, host: str = None, port: int = None, *,
|
||||
ssl: Any = None, family: int = 0, proto: int = 0, flags: int = 0, sock: Any = None,
|
||||
local_addr: str = None, server_hostname: str = None) -> tuple: ...
|
||||
# ?? check Any
|
||||
# return (Transport, Protocol)
|
||||
@abstractmethod
|
||||
def create_server(self, protocol_factory: Any, host: str = None, port: int = None, *,
|
||||
family: int = AF_UNSPEC, flags: int = AI_PASSIVE,
|
||||
sock: Any = None, backlog: int = 100, ssl: Any = None, reuse_address: Any = None) -> Any: ...
|
||||
# ?? check Any
|
||||
# return Server
|
||||
@abstractmethod
|
||||
def create_unix_connection(self, protocol_factory: Any, path: str, *,
|
||||
ssl: Any = None, sock: Any = None,
|
||||
server_hostname: str = None) -> tuple: ...
|
||||
# ?? check Any
|
||||
# return tuple(Transport, Protocol)
|
||||
@abstractmethod
|
||||
def create_unix_server(self, protocol_factory: Any, path: str, *,
|
||||
sock: Any = None, backlog: int = 100, ssl: Any = None) -> Any: ...
|
||||
# ?? check Any
|
||||
# return Server
|
||||
@abstractmethod
|
||||
def create_datagram_endpoint(self, protocol_factory: Any,
|
||||
local_addr: str = None, remote_addr: str = None, *,
|
||||
family: int = 0, proto: int = 0, flags: int = 0) -> tuple: ...
|
||||
#?? check Any
|
||||
# return (Transport, Protocol)
|
||||
# Pipes and subprocesses.
|
||||
@abstractmethod
|
||||
def connect_read_pipe(self, protocol_factory: Any, pipe: Any) -> tuple: ...
|
||||
#?? check Any
|
||||
# return (Transport, Protocol)
|
||||
@abstractmethod
|
||||
def connect_write_pipe(self, protocol_factory: Any, pipe: Any) -> tuple: ...
|
||||
#?? check Any
|
||||
# return (Transport, Protocol)
|
||||
@abstractmethod
|
||||
def subprocess_shell(self, protocol_factory: Any, cmd: Union[bytes, str], *, stdin: Any = PIPE,
|
||||
stdout: Any = PIPE, stderr: Any = PIPE,
|
||||
**kwargs: Dict[str, Any]) -> tuple: ...
|
||||
#?? check Any
|
||||
# return (Transport, Protocol)
|
||||
@abstractmethod
|
||||
def subprocess_exec(self, protocol_factory: Any, *args: List[Any], stdin: Any = PIPE,
|
||||
stdout: Any = PIPE, stderr: Any = PIPE,
|
||||
**kwargs: Dict[str, Any]) -> tuple: ...
|
||||
#?? check Any
|
||||
# return (Transport, Protocol)
|
||||
@abstractmethod
|
||||
def add_reader(self, fd: int, callback: Callable[[],Any], *args: List[Any]) -> None: ...
|
||||
@abstractmethod
|
||||
def remove_reader(self, fd: int) -> None: ...
|
||||
@abstractmethod
|
||||
def add_writer(self, fd: int, callback: Callable[[],Any], *args: List[Any]) -> None: ...
|
||||
@abstractmethod
|
||||
def remove_writer(self, fd: int) -> None: ...
|
||||
# Completion based I/O methods returning Futures.
|
||||
@abstractmethod
|
||||
def sock_recv(self, sock: Any, nbytes: int) -> Any: ... #TODO
|
||||
@abstractmethod
|
||||
def sock_sendall(self, sock: Any, data: bytes) -> None: ... #TODO
|
||||
@abstractmethod
|
||||
def sock_connect(self, sock: Any, address: str) -> Any: ... #TODO
|
||||
@abstractmethod
|
||||
def sock_accept(self, sock: Any) -> Any: ...
|
||||
# Signal handling.
|
||||
@abstractmethod
|
||||
def add_signal_handler(self, sig: int, callback: Callable[[],Any], *args: List[Any]) -> None: ...
|
||||
@abstractmethod
|
||||
def remove_signal_handler(self, sig: int) -> None: ...
|
||||
# Error handlers.
|
||||
@abstractmethod
|
||||
def set_exception_handler(self, handler: Callable[[], Any]) -> None: ...
|
||||
@abstractmethod
|
||||
def default_exception_handler(self, context: Any) -> None: ...
|
||||
@abstractmethod
|
||||
def call_exception_handler(self, context: Any) -> None: ...
|
||||
# Debug flag management.
|
||||
@abstractmethod
|
||||
def get_debug(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def set_debug(self, enabled: bool) -> None: ...
|
||||
|
||||
class AbstractEventLoopPolicy(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def get_event_loop(self) -> AbstractEventLoop: ...
|
||||
@abstractmethod
|
||||
def set_event_loop(self, loop: AbstractEventLoop): ...
|
||||
@abstractmethod
|
||||
def new_event_loop(self) -> Any: ... # return selector_events.BaseSelectorEventLoop
|
||||
# Child processes handling (Unix only).
|
||||
@abstractmethod
|
||||
def get_child_watcher(self) -> Any: ... # return unix_events.AbstractChildWatcher
|
||||
@abstractmethod
|
||||
def set_child_watcher(self, watcher: Any) -> None: ... # gen unix_events.AbstractChildWatcher
|
||||
|
||||
class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy):
|
||||
def __init__(self) -> None: ...
|
||||
def get_event_loop(self) -> AbstractEventLoop: ...
|
||||
def set_event_loop(self, loop: AbstractEventLoop): ...
|
||||
def new_event_loop(self) -> Any: ... # Same return than AbstractEventLoop
|
||||
|
||||
|
||||
def get_event_loop() -> AbstractEventLoop: ...
|
||||
@@ -0,0 +1,41 @@
|
||||
from typing import Any, Callable, TypeVar, List, Generic, Iterable, Iterator
|
||||
from asyncio.events import AbstractEventLoop
|
||||
# __all__ = ['CancelledError', 'TimeoutError',
|
||||
# 'InvalidStateError',
|
||||
# 'wrap_future',
|
||||
# ]
|
||||
__all__ = ['Future']
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class _TracebackLogger:
|
||||
__slots__ = [] # type: List[str]
|
||||
exc = Any # Exception
|
||||
tb = [] # type: List[str]
|
||||
def __init__(self, exc: Any, loop: AbstractEventLoop) -> None: ...
|
||||
def activate(self) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
class Future(Iterator[_T], Generic[_T]):
|
||||
_state = ''
|
||||
_exception = Any #Exception
|
||||
_blocking = False
|
||||
_log_traceback = False
|
||||
_tb_logger = _TracebackLogger
|
||||
def __init__(self, *, loop: AbstractEventLoop = None) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __del__(self) -> None: ...
|
||||
def cancel(self) -> bool: ...
|
||||
def _schedule_callbacks(self) -> None: ...
|
||||
def cancelled(self) -> bool: ...
|
||||
def done(self) -> bool: ...
|
||||
def result(self) -> _T: ...
|
||||
def exception(self) -> Any: ...
|
||||
def add_done_callback(self, fn: Callable[[Future[_T]], Any]) -> None: ...
|
||||
def remove_done_callback(self, fn: Callable[[Future[_T]], Any]) -> int: ...
|
||||
def set_result(self, result: _T) -> None: ...
|
||||
def set_exception(self, exception: Any) -> None: ...
|
||||
def _copy_state(self, other: Any) -> None: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __next__(self) -> _T: ...
|
||||
@@ -0,0 +1,47 @@
|
||||
from typing import TypeVar, Generic
|
||||
|
||||
__all__ = ['Queue', 'PriorityQueue', 'LifoQueue', 'JoinableQueue',
|
||||
'QueueFull', 'QueueEmpty']
|
||||
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from .tasks import coroutine
|
||||
|
||||
|
||||
class QueueEmpty(Exception): ...
|
||||
class QueueFull(Exception): ...
|
||||
|
||||
T = TypeVar('T')
|
||||
|
||||
class Queue(Generic[T]):
|
||||
def __init__(self, maxsize: int = 0, *, loop: AbstractEventLoop = None) -> None: ...
|
||||
def _init(self, maxsize: int) -> None: ...
|
||||
def _get(self) -> T: ...
|
||||
def _put(self, item: T) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def _format(self) -> str: ...
|
||||
def _consume_done_getters(self) -> None: ...
|
||||
def _consume_done_putters(self) -> None: ...
|
||||
def qsize(self) -> int: ...
|
||||
@property
|
||||
def maxsize(self) -> int: ...
|
||||
def empty(self) -> bool: ...
|
||||
def full(self) -> bool: ...
|
||||
@coroutine
|
||||
def put(self, item: T) -> None: ...
|
||||
def put_nowait(self, item: T) -> None: ...
|
||||
@coroutine
|
||||
def get(self) -> T: ...
|
||||
def get_nowait(self) -> T: ...
|
||||
|
||||
|
||||
class PriorityQueue(Queue): ...
|
||||
|
||||
|
||||
class LifoQueue(Queue): ...
|
||||
|
||||
|
||||
class JoinableQueue(Queue):
|
||||
def task_done(self) -> None: ...
|
||||
@coroutine
|
||||
def join(self) -> None: ...
|
||||
@@ -0,0 +1,38 @@
|
||||
from typing import Any, Iterable, TypeVar, Set, Dict, List, TextIO, Union, Tuple, Generic, Callable
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from asyncio.futures import Future
|
||||
# __all__ = ['iscoroutinefunction', 'iscoroutine',
|
||||
# 'as_completed', 'async',
|
||||
# 'gather', 'shield',
|
||||
# ]
|
||||
|
||||
__all__ = ['coroutine', 'Task', 'sleep',
|
||||
'FIRST_COMPLETED', 'FIRST_EXCEPTION', 'ALL_COMPLETED',
|
||||
'wait', 'wait_for']
|
||||
|
||||
FIRST_EXCEPTION = 'FIRST_EXCEPTION'
|
||||
FIRST_COMPLETED = 'FIRST_COMPLETED'
|
||||
ALL_COMPLETED = 'ALL_COMPLETED'
|
||||
_T = TypeVar('_T')
|
||||
def coroutine(f: _T) -> _T: ... # Here comes and go a function
|
||||
def sleep(delay: float, result: _T = None, loop: AbstractEventLoop = None) -> Future[_T]: ...
|
||||
def wait(fs: List[Task[_T]], *, loop: AbstractEventLoop = None,
|
||||
timeout: float = None, return_when: str = ALL_COMPLETED) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ...
|
||||
def wait_for(fut: Future[_T], timeout: float, *, loop: AbstractEventLoop = None) -> Future[_T]: ...
|
||||
|
||||
|
||||
class Task(Future[_T], Generic[_T]):
|
||||
_all_tasks = None # type: Set[Task]
|
||||
_current_tasks = {} # type: Dict[AbstractEventLoop, Task]
|
||||
@classmethod
|
||||
def current_task(cls, loop: AbstractEventLoop = None) -> Task: ...
|
||||
@classmethod
|
||||
def all_tasks(cls, loop: AbstractEventLoop = None) -> Set[Task]: ...
|
||||
def __init__(self, coro: Future[_T], *, loop: AbstractEventLoop = None) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def get_stack(self, *, limit: int = None) -> List[Any]: ... # return List[stackframe]
|
||||
def print_stack(self, *, limit: int = None, file: TextIO = None) -> None: ...
|
||||
def cancel(self) -> bool: ...
|
||||
def _step(self, value: Any = None, exc: Exception = None) -> None: ...
|
||||
def _wakeup(self, future: Future[Any]) -> None: ...
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
from typing import List, Any, TypeVar
|
||||
|
||||
class Enum:
|
||||
def __new__(cls, value: Any) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __dir__(self) -> List[str]: ...
|
||||
def __format__(self, format_spec: str) -> str: ...
|
||||
def __hash__(self) -> Any: ...
|
||||
def __reduce_ex__(self, proto: Any) -> Any: ...
|
||||
|
||||
name = ''
|
||||
value = None # type: Any
|
||||
|
||||
class IntEnum(int, Enum): ...
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
def unique(enumeration: _T) -> _T: ...
|
||||
@@ -0,0 +1,164 @@
|
||||
# Stubs for pathlib (Python 3.4)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
from collections import Sequence
|
||||
|
||||
class _Flavour:
|
||||
join = ... # type: Any
|
||||
def __init__(self): ...
|
||||
def parse_parts(self, parts): ...
|
||||
def join_parsed_parts(self, drv, root, parts, drv2, root2, parts2): ...
|
||||
|
||||
class _WindowsFlavour(_Flavour):
|
||||
sep = ... # type: Any
|
||||
altsep = ... # type: Any
|
||||
has_drv = ... # type: Any
|
||||
pathmod = ... # type: Any
|
||||
is_supported = ... # type: Any
|
||||
drive_letters = ... # type: Any
|
||||
ext_namespace_prefix = ... # type: Any
|
||||
reserved_names = ... # type: Any
|
||||
def splitroot(self, part, sep=...): ...
|
||||
def casefold(self, s): ...
|
||||
def casefold_parts(self, parts): ...
|
||||
def resolve(self, path): ...
|
||||
def is_reserved(self, parts): ...
|
||||
def make_uri(self, path): ...
|
||||
|
||||
class _PosixFlavour(_Flavour):
|
||||
sep = ... # type: Any
|
||||
altsep = ... # type: Any
|
||||
has_drv = ... # type: Any
|
||||
pathmod = ... # type: Any
|
||||
is_supported = ... # type: Any
|
||||
def splitroot(self, part, sep=...): ...
|
||||
def casefold(self, s): ...
|
||||
def casefold_parts(self, parts): ...
|
||||
def resolve(self, path): ...
|
||||
def is_reserved(self, parts): ...
|
||||
def make_uri(self, path): ...
|
||||
|
||||
class _Accessor: ...
|
||||
|
||||
class _NormalAccessor(_Accessor):
|
||||
stat = ... # type: Any
|
||||
lstat = ... # type: Any
|
||||
open = ... # type: Any
|
||||
listdir = ... # type: Any
|
||||
chmod = ... # type: Any
|
||||
lchmod = ... # type: Any
|
||||
mkdir = ... # type: Any
|
||||
unlink = ... # type: Any
|
||||
rmdir = ... # type: Any
|
||||
rename = ... # type: Any
|
||||
replace = ... # type: Any
|
||||
def symlink(a, b, target_is_directory): ...
|
||||
utime = ... # type: Any
|
||||
def readlink(self, path): ...
|
||||
|
||||
class _Selector:
|
||||
child_parts = ... # type: Any
|
||||
successor = ... # type: Any
|
||||
def __init__(self, child_parts): ...
|
||||
def select_from(self, parent_path): ...
|
||||
|
||||
class _TerminatingSelector: ...
|
||||
|
||||
class _PreciseSelector(_Selector):
|
||||
name = ... # type: Any
|
||||
def __init__(self, name, child_parts): ...
|
||||
|
||||
class _WildcardSelector(_Selector):
|
||||
pat = ... # type: Any
|
||||
def __init__(self, pat, child_parts): ...
|
||||
|
||||
class _RecursiveWildcardSelector(_Selector):
|
||||
def __init__(self, pat, child_parts): ...
|
||||
|
||||
class _PathParents(Sequence):
|
||||
def __init__(self, path): ...
|
||||
def __len__(self): ...
|
||||
def __getitem__(self, idx): ...
|
||||
|
||||
class PurePath:
|
||||
def __init__(self, *args): ...
|
||||
def __reduce__(self): ...
|
||||
def as_posix(self): ...
|
||||
def __bytes__(self): ...
|
||||
def as_uri(self): ...
|
||||
def __eq__(self, other): ...
|
||||
def __ne__(self, other): ...
|
||||
def __hash__(self): ...
|
||||
def __lt__(self, other): ...
|
||||
def __le__(self, other): ...
|
||||
def __gt__(self, other): ...
|
||||
def __ge__(self, other): ...
|
||||
drive = ... # type: Any
|
||||
root = ... # type: Any
|
||||
@property
|
||||
def anchor(self): ...
|
||||
@property
|
||||
def name(self): ...
|
||||
@property
|
||||
def suffix(self): ...
|
||||
@property
|
||||
def suffixes(self): ...
|
||||
@property
|
||||
def stem(self): ...
|
||||
def with_name(self, name): ...
|
||||
def with_suffix(self, suffix): ...
|
||||
def relative_to(self, *other): ...
|
||||
@property
|
||||
def parts(self): ...
|
||||
def joinpath(self, *args): ...
|
||||
def __truediv__(self, key): ...
|
||||
def __rtruediv__(self, key): ...
|
||||
@property
|
||||
def parent(self): ...
|
||||
@property
|
||||
def parents(self): ...
|
||||
def is_absolute(self): ...
|
||||
def is_reserved(self): ...
|
||||
def match(self, path_pattern): ...
|
||||
|
||||
class PurePosixPath(PurePath): ...
|
||||
class PureWindowsPath(PurePath): ...
|
||||
|
||||
class Path(PurePath):
|
||||
def __init__(self, *args, **kwargs): ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, t, v, tb): ...
|
||||
@classmethod
|
||||
def cwd(cls): ...
|
||||
def iterdir(self): ...
|
||||
def glob(self, pattern): ...
|
||||
def rglob(self, pattern): ...
|
||||
def absolute(self): ...
|
||||
def resolve(self): ...
|
||||
def stat(self): ...
|
||||
def owner(self): ...
|
||||
def group(self): ...
|
||||
def open(self, mode='', buffering=-1, encoding=None, errors=None, newline=None): ...
|
||||
def touch(self, mode=438, exist_ok=True): ...
|
||||
def mkdir(self, mode=511, parents=False): ...
|
||||
def chmod(self, mode): ...
|
||||
def lchmod(self, mode): ...
|
||||
def unlink(self): ...
|
||||
def rmdir(self): ...
|
||||
def lstat(self): ...
|
||||
def rename(self, target): ...
|
||||
def replace(self, target): ...
|
||||
def symlink_to(self, target, target_is_directory=False): ...
|
||||
def exists(self): ...
|
||||
def is_dir(self): ...
|
||||
def is_file(self): ...
|
||||
def is_symlink(self): ...
|
||||
def is_block_device(self): ...
|
||||
def is_char_device(self): ...
|
||||
def is_fifo(self): ...
|
||||
def is_socket(self): ...
|
||||
|
||||
class PosixPath(Path, PurePosixPath): ...
|
||||
class WindowsPath(Path, PureWindowsPath): ...
|
||||
@@ -0,0 +1,9 @@
|
||||
class _Feature: ...
|
||||
|
||||
absolute_import = ... # type: _Feature
|
||||
division = ... # type: _Feature
|
||||
generators = ... # type: _Feature
|
||||
nested_scopes = ... # type: _Feature
|
||||
print_function = ... # type: _Feature
|
||||
unicode_literals = ... # type: _Feature
|
||||
with_statement = ... # type: _Feature
|
||||
@@ -0,0 +1,11 @@
|
||||
# Stubs for _dummy_thread
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import Any
|
||||
|
||||
class LockType:
|
||||
def acquire(self) -> None: ...
|
||||
def release(self) -> None: ...
|
||||
|
||||
def allocate_lock() -> LockType: ...
|
||||
@@ -0,0 +1,13 @@
|
||||
# Stubs for _posixsubprocess
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import Tuple, Sequence
|
||||
|
||||
def cloexec_pipe() -> Tuple[int, int]: ...
|
||||
def fork_exec(args: Sequence[str],
|
||||
executable_list, close_fds, fds_to_keep, cwd: str, env_list,
|
||||
p2cread: int, p2cwrite: int, c2pred: int, c2pwrite: int,
|
||||
errread: int, errwrite: int, errpipe_read: int,
|
||||
errpipe_write: int, restore_signals, start_new_session,
|
||||
preexec_fn) -> int: ...
|
||||
@@ -0,0 +1,38 @@
|
||||
# Stubs for _subprocess
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import Mapping, Any, Tuple
|
||||
|
||||
CREATE_NEW_CONSOLE = 0
|
||||
CREATE_NEW_PROCESS_GROUP = 0
|
||||
STD_INPUT_HANDLE = 0
|
||||
STD_OUTPUT_HANDLE = 0
|
||||
STD_ERROR_HANDLE = 0
|
||||
SW_HIDE = 0
|
||||
STARTF_USESTDHANDLES = 0
|
||||
STARTF_USESHOWWINDOW = 0
|
||||
INFINITE = 0
|
||||
DUPLICATE_SAME_ACCESS = 0
|
||||
WAIT_OBJECT_0 = 0
|
||||
|
||||
# TODO not exported by the Python module
|
||||
class Handle:
|
||||
def Close(self) -> None: ...
|
||||
|
||||
def GetVersion() -> int: ...
|
||||
def GetExitCodeProcess(handle: Handle) -> int: ...
|
||||
def WaitForSingleObject(handle: Handle, timeout: int) -> int: ...
|
||||
def CreateProcess(executable: str, cmd_line: str,
|
||||
proc_attrs, thread_attrs,
|
||||
inherit: int, flags: int,
|
||||
env_mapping: Mapping[str, str],
|
||||
curdir: str,
|
||||
startupinfo: Any) -> Tuple[Any, Handle, int, int]: ...
|
||||
def GetModuleFileName(module: int) -> str: ...
|
||||
def GetCurrentProcess() -> Handle: ...
|
||||
def DuplicateHandle(source_proc: Handle, source: Handle, target_proc: Handle,
|
||||
target: Any, access: int, inherit: int) -> int: ...
|
||||
def CreatePipe(pipe_attrs, size: int) -> Tuple[Handle, Handle]: ...
|
||||
def GetStdHandle(arg: int) -> int: ...
|
||||
def TerminateProcess(handle: Handle, exit_code: int) -> None: ...
|
||||
@@ -0,0 +1,14 @@
|
||||
# Stubs for _thread
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import Any
|
||||
|
||||
def _count() -> int: ...
|
||||
_dangling = ... # type: Any
|
||||
|
||||
class LockType:
|
||||
def acquire(self) -> None: ...
|
||||
def release(self) -> None: ...
|
||||
|
||||
def allocate_lock() -> LockType: ...
|
||||
@@ -0,0 +1,5 @@
|
||||
# Stubs for abc.
|
||||
|
||||
# Thesee definitions have special processing in type checker.
|
||||
class ABCMeta: ...
|
||||
abstractmethod = object()
|
||||
@@ -0,0 +1,161 @@
|
||||
# Stubs for argparse (Python 3)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Sequence
|
||||
|
||||
SUPPRESS = ... # type: Any
|
||||
OPTIONAL = ... # type: Any
|
||||
ZERO_OR_MORE = ... # type: Any
|
||||
ONE_OR_MORE = ... # type: Any
|
||||
PARSER = ... # type: Any
|
||||
REMAINDER = ... # type: Any
|
||||
|
||||
class _AttributeHolder: ...
|
||||
|
||||
class HelpFormatter:
|
||||
def __init__(self, prog, indent_increment=2, max_help_position=24, width=None): ...
|
||||
def start_section(self, heading): ...
|
||||
def end_section(self): ...
|
||||
def add_text(self, text): ...
|
||||
def add_usage(self, usage, actions, groups, prefix=None): ...
|
||||
def add_argument(self, action): ...
|
||||
def add_arguments(self, actions): ...
|
||||
def format_help(self): ...
|
||||
|
||||
class RawDescriptionHelpFormatter(HelpFormatter): ...
|
||||
class RawTextHelpFormatter(RawDescriptionHelpFormatter): ...
|
||||
class ArgumentDefaultsHelpFormatter(HelpFormatter): ...
|
||||
class MetavarTypeHelpFormatter(HelpFormatter): ...
|
||||
|
||||
class ArgumentError(Exception):
|
||||
argument_name = ... # type: Any
|
||||
message = ... # type: Any
|
||||
def __init__(self, argument, message): ...
|
||||
|
||||
class ArgumentTypeError(Exception): ...
|
||||
|
||||
class Action(_AttributeHolder):
|
||||
option_strings = ... # type: Any
|
||||
dest = ... # type: Any
|
||||
nargs = ... # type: Any
|
||||
const = ... # type: Any
|
||||
default = ... # type: Any
|
||||
type = ... # type: Any
|
||||
choices = ... # type: Any
|
||||
required = ... # type: Any
|
||||
help = ... # type: Any
|
||||
metavar = ... # type: Any
|
||||
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None,
|
||||
choices=None, required=False, help=None, metavar=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _StoreAction(Action):
|
||||
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None,
|
||||
choices=None, required=False, help=None, metavar=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _StoreConstAction(Action):
|
||||
def __init__(self, option_strings, dest, const, default=None, required=False, help=None,
|
||||
metavar=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _StoreTrueAction(_StoreConstAction):
|
||||
def __init__(self, option_strings, dest, default=False, required=False, help=None): ...
|
||||
|
||||
class _StoreFalseAction(_StoreConstAction):
|
||||
def __init__(self, option_strings, dest, default=True, required=False, help=None): ...
|
||||
|
||||
class _AppendAction(Action):
|
||||
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None,
|
||||
choices=None, required=False, help=None, metavar=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _AppendConstAction(Action):
|
||||
def __init__(self, option_strings, dest, const, default=None, required=False, help=None,
|
||||
metavar=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _CountAction(Action):
|
||||
def __init__(self, option_strings, dest, default=None, required=False, help=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _HelpAction(Action):
|
||||
def __init__(self, option_strings, dest=..., default=..., help=None): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _VersionAction(Action):
|
||||
version = ... # type: Any
|
||||
def __init__(self, option_strings, version=None, dest=..., default=...,
|
||||
help=''): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class _SubParsersAction(Action):
|
||||
def __init__(self, option_strings, prog, parser_class, dest=..., help=None,
|
||||
metavar=None): ...
|
||||
def add_parser(self, name, **kwargs): ...
|
||||
def __call__(self, parser, namespace, values, option_string=None): ...
|
||||
|
||||
class FileType:
|
||||
def __init__(self, mode='', bufsize=-1, encoding=None, errors=None): ...
|
||||
def __call__(self, string): ...
|
||||
|
||||
class Namespace(_AttributeHolder):
|
||||
def __init__(self, **kwargs): ...
|
||||
def __eq__(self, other): ...
|
||||
def __ne__(self, other): ...
|
||||
def __contains__(self, key): ...
|
||||
|
||||
class _ActionsContainer:
|
||||
description = ... # type: Any
|
||||
argument_default = ... # type: Any
|
||||
prefix_chars = ... # type: Any
|
||||
conflict_handler = ... # type: Any
|
||||
def __init__(self, description, prefix_chars, argument_default, conflict_handler): ...
|
||||
def register(self, registry_name, value, object): ...
|
||||
def set_defaults(self, **kwargs): ...
|
||||
def get_default(self, dest): ...
|
||||
def add_argument(self,
|
||||
*args: str,
|
||||
action: str = None,
|
||||
nargs: str = None,
|
||||
const: Any = None,
|
||||
default: Any = None,
|
||||
type: Any = None,
|
||||
choices: Any = None, # TODO: Container?
|
||||
required: bool = None,
|
||||
help: str = None,
|
||||
metavar: str = None,
|
||||
dest: str = None,
|
||||
) -> None: ...
|
||||
def add_argument_group(self, *args, **kwargs): ...
|
||||
def add_mutually_exclusive_group(self, **kwargs): ...
|
||||
|
||||
class _ArgumentGroup(_ActionsContainer):
|
||||
title = ... # type: Any
|
||||
def __init__(self, container, title=None, description=None, **kwargs): ...
|
||||
|
||||
class _MutuallyExclusiveGroup(_ArgumentGroup):
|
||||
required = ... # type: Any
|
||||
def __init__(self, container, required=False): ...
|
||||
|
||||
class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
prog = ... # type: Any
|
||||
usage = ... # type: Any
|
||||
epilog = ... # type: Any
|
||||
formatter_class = ... # type: Any
|
||||
fromfile_prefix_chars = ... # type: Any
|
||||
add_help = ... # type: Any
|
||||
def __init__(self, prog=None, usage=None, description=None, epilog=None, parents=...,
|
||||
formatter_class=..., prefix_chars='', fromfile_prefix_chars=None,
|
||||
argument_default=None, conflict_handler='', add_help=True): ...
|
||||
def add_subparsers(self, **kwargs): ...
|
||||
def parse_args(self, args: Sequence[str] = None, namespace=None) -> Any: ...
|
||||
def parse_known_args(self, args=None, namespace=None): ...
|
||||
def convert_arg_line_to_args(self, arg_line): ...
|
||||
def format_usage(self): ...
|
||||
def format_help(self): ...
|
||||
def print_usage(self, file=None): ...
|
||||
def print_help(self, file=None): ...
|
||||
def exit(self, status=0, message=None): ...
|
||||
def error(self, message): ...
|
||||
@@ -0,0 +1,5 @@
|
||||
from typing import TypeVar, Any
|
||||
|
||||
_FT = TypeVar('_FT')
|
||||
|
||||
def register(func: _FT, *args: Any, **kargs: Any) -> _FT: ...
|
||||
@@ -0,0 +1,25 @@
|
||||
# Stubs for base64
|
||||
|
||||
# Based on http://docs.python.org/3.2/library/base64.html
|
||||
|
||||
from typing import IO
|
||||
|
||||
def b64encode(s: bytes, altchars: bytes = None) -> bytes: ...
|
||||
def b64decode(s: bytes, altchars: bytes = None,
|
||||
validate: bool = False) -> bytes: ...
|
||||
def standard_b64encode(s: bytes) -> bytes: ...
|
||||
def standard_b64decode(s: bytes) -> bytes: ...
|
||||
def urlsafe_b64encode(s: bytes) -> bytes: ...
|
||||
def urlsafe_b64decode(s: bytes) -> bytes: ...
|
||||
def b32encode(s: bytes) -> bytes: ...
|
||||
def b32decode(s: bytes, casefold: bool = False,
|
||||
map01: bytes = None) -> bytes: ...
|
||||
def b16encode(s: bytes) -> bytes: ...
|
||||
def b16decode(s: bytes, casefold: bool = False) -> bytes: ...
|
||||
|
||||
def decode(input: IO[bytes], output: IO[bytes]) -> None: ...
|
||||
def decodebytes(s: bytes) -> bytes: ...
|
||||
def decodestring(s: bytes) -> bytes: ...
|
||||
def encode(input: IO[bytes], output: IO[bytes]) -> None: ...
|
||||
def encodebytes(s: bytes) -> bytes: ...
|
||||
def encodestring(s: bytes) -> bytes: ...
|
||||
@@ -0,0 +1,801 @@
|
||||
# Stubs for builtins (Python 3)
|
||||
|
||||
from typing import (
|
||||
TypeVar, Iterator, Iterable, overload,
|
||||
Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic,
|
||||
Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
|
||||
SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString
|
||||
)
|
||||
from abc import abstractmethod, ABCMeta
|
||||
|
||||
# Note that names imported above are not automatically made visible via the
|
||||
# implicit builtins import.
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T_co = TypeVar('_T_co', covariant=True)
|
||||
_KT = TypeVar('_KT')
|
||||
_VT = TypeVar('_VT')
|
||||
_S = TypeVar('_S')
|
||||
_T1 = TypeVar('_T1')
|
||||
_T2 = TypeVar('_T2')
|
||||
_T3 = TypeVar('_T3')
|
||||
_T4 = TypeVar('_T4')
|
||||
|
||||
staticmethod = object() # Only valid as a decorator.
|
||||
classmethod = object() # Only valid as a decorator.
|
||||
property = object()
|
||||
|
||||
class object:
|
||||
__doc__ = ''
|
||||
__class__ = ... # type: type
|
||||
|
||||
def __init__(self) -> None: ...
|
||||
def __eq__(self, o: object) -> bool: ...
|
||||
def __ne__(self, o: object) -> bool: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class type:
|
||||
__name__ = ''
|
||||
__qualname__ = ''
|
||||
__module__ = ''
|
||||
__dict__ = ... # type: Dict[str, Any]
|
||||
|
||||
def __init__(self, o: object) -> None: ...
|
||||
@staticmethod
|
||||
def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ...
|
||||
|
||||
class int(SupportsInt, SupportsFloat, SupportsAbs[int]):
|
||||
def __init__(self, x: Union[SupportsInt, str, bytes] = None, base: int = None) -> None: ...
|
||||
def bit_length(self) -> int: ...
|
||||
def to_bytes(self, length: int, byteorder: str, *, signed: bool = False) -> bytes: ...
|
||||
@classmethod
|
||||
def from_bytes(cls, bytes: Sequence[int], byteorder: str, *,
|
||||
signed: bool = False) -> int: ... # TODO buffer object argument
|
||||
|
||||
def __add__(self, x: int) -> int: ...
|
||||
def __sub__(self, x: int) -> int: ...
|
||||
def __mul__(self, x: int) -> int: ...
|
||||
def __floordiv__(self, x: int) -> int: ...
|
||||
def __truediv__(self, x: int) -> float: ...
|
||||
def __mod__(self, x: int) -> int: ...
|
||||
def __radd__(self, x: int) -> int: ...
|
||||
def __rsub__(self, x: int) -> int: ...
|
||||
def __rmul__(self, x: int) -> int: ...
|
||||
def __rfloordiv__(self, x: int) -> int: ...
|
||||
def __rtruediv__(self, x: int) -> float: ...
|
||||
def __rmod__(self, x: int) -> int: ...
|
||||
def __pow__(self, x: int) -> Any: ... # Return type can be int or float, depending on x.
|
||||
def __rpow__(self, x: int) -> Any: ...
|
||||
def __and__(self, n: int) -> int: ...
|
||||
def __or__(self, n: int) -> int: ...
|
||||
def __xor__(self, n: int) -> int: ...
|
||||
def __lshift__(self, n: int) -> int: ...
|
||||
def __rshift__(self, n: int) -> int: ...
|
||||
def __rand__(self, n: int) -> int: ...
|
||||
def __ror__(self, n: int) -> int: ...
|
||||
def __rxor__(self, n: int) -> int: ...
|
||||
def __rlshift__(self, n: int) -> int: ...
|
||||
def __rrshift__(self, n: int) -> int: ...
|
||||
def __neg__(self) -> int: ...
|
||||
def __pos__(self) -> int: ...
|
||||
def __invert__(self) -> int: ...
|
||||
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __lt__(self, x: int) -> bool: ...
|
||||
def __le__(self, x: int) -> bool: ...
|
||||
def __gt__(self, x: int) -> bool: ...
|
||||
def __ge__(self, x: int) -> bool: ...
|
||||
|
||||
def __str__(self) -> str: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __int__(self) -> int: return self
|
||||
def __abs__(self) -> int: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class float(SupportsFloat, SupportsInt, SupportsAbs[float]):
|
||||
def __init__(self, x: Union[SupportsFloat, str, bytes]=None) -> None: ...
|
||||
def as_integer_ratio(self) -> Tuple[int, int]: ...
|
||||
def hex(self) -> str: ...
|
||||
def is_integer(self) -> bool: ...
|
||||
@classmethod
|
||||
def fromhex(cls, s: str) -> float: ...
|
||||
|
||||
def __add__(self, x: float) -> float: ...
|
||||
def __sub__(self, x: float) -> float: ...
|
||||
def __mul__(self, x: float) -> float: ...
|
||||
def __floordiv__(self, x: float) -> float: ...
|
||||
def __truediv__(self, x: float) -> float: ...
|
||||
def __mod__(self, x: float) -> float: ...
|
||||
def __pow__(self, x: float) -> float: ...
|
||||
def __radd__(self, x: float) -> float: ...
|
||||
def __rsub__(self, x: float) -> float: ...
|
||||
def __rmul__(self, x: float) -> float: ...
|
||||
def __rfloordiv__(self, x: float) -> float: ...
|
||||
def __rtruediv__(self, x: float) -> float: ...
|
||||
def __rmod__(self, x: float) -> float: ...
|
||||
def __rpow__(self, x: float) -> float: ...
|
||||
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __lt__(self, x: float) -> bool: ...
|
||||
def __le__(self, x: float) -> bool: ...
|
||||
def __gt__(self, x: float) -> bool: ...
|
||||
def __ge__(self, x: float) -> bool: ...
|
||||
def __neg__(self) -> float: ...
|
||||
def __pos__(self) -> float: ...
|
||||
|
||||
def __str__(self) -> str: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __abs__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class complex(SupportsAbs[float]):
|
||||
@overload
|
||||
def __init__(self, re: float = 0.0, im: float = 0.0) -> None: ...
|
||||
@overload
|
||||
def __init__(self, s: str) -> None: ...
|
||||
|
||||
@property
|
||||
def real(self) -> float: ...
|
||||
@property
|
||||
def imag(self) -> float: ...
|
||||
|
||||
def conjugate(self) -> complex: ...
|
||||
|
||||
def __add__(self, x: complex) -> complex: ...
|
||||
def __sub__(self, x: complex) -> complex: ...
|
||||
def __mul__(self, x: complex) -> complex: ...
|
||||
def __pow__(self, x: complex) -> complex: ...
|
||||
def __truediv__(self, x: complex) -> complex: ...
|
||||
def __radd__(self, x: complex) -> complex: ...
|
||||
def __rsub__(self, x: complex) -> complex: ...
|
||||
def __rmul__(self, x: complex) -> complex: ...
|
||||
def __rpow__(self, x: complex) -> complex: ...
|
||||
def __rtruediv__(self, x: complex) -> complex: ...
|
||||
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __neg__(self) -> complex: ...
|
||||
def __pos__(self) -> complex: ...
|
||||
|
||||
def __str__(self) -> str: ...
|
||||
def __abs__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class str(Sequence[str]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, o: object) -> None: ...
|
||||
@overload
|
||||
def __init__(self, o: bytes, encoding: str = None, errors: str = 'strict') -> None: ...
|
||||
def capitalize(self) -> str: ...
|
||||
def center(self, width: int, fillchar: str = ' ') -> str: ...
|
||||
def count(self, x: str) -> int: ...
|
||||
def encode(self, encoding: str = 'utf-8', errors: str = 'strict') -> bytes: ...
|
||||
def endswith(self, suffix: Union[str, Tuple[str, ...]], start: int = None,
|
||||
end: int = None) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = 8) -> str: ...
|
||||
def find(self, sub: str, start: int = 0, end: int = 0) -> int: ...
|
||||
def format(self, *args: Any, **kwargs: Any) -> str: ...
|
||||
def format_map(self, map: Mapping[str, Any]) -> str: ...
|
||||
def index(self, sub: str, start: int = 0, end: int = 0) -> int: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
def isalpha(self) -> bool: ...
|
||||
def isdecimal(self) -> bool: ...
|
||||
def isdigit(self) -> bool: ...
|
||||
def isidentifier(self) -> bool: ...
|
||||
def islower(self) -> bool: ...
|
||||
def isnumeric(self) -> bool: ...
|
||||
def isprintable(self) -> bool: ...
|
||||
def isspace(self) -> bool: ...
|
||||
def istitle(self) -> bool: ...
|
||||
def isupper(self) -> bool: ...
|
||||
def join(self, iterable: Iterable[str]) -> str: ...
|
||||
def ljust(self, width: int, fillchar: str = ' ') -> str: ...
|
||||
def lower(self) -> str: ...
|
||||
def lstrip(self, chars: str = None) -> str: ...
|
||||
def partition(self, sep: str) -> Tuple[str, str, str]: ...
|
||||
def replace(self, old: str, new: str, count: int = -1) -> str: ...
|
||||
def rfind(self, sub: str, start: int = 0, end: int = 0) -> int: ...
|
||||
def rindex(self, sub: str, start: int = 0, end: int = 0) -> int: ...
|
||||
def rjust(self, width: int, fillchar: str = ' ') -> str: ...
|
||||
def rpartition(self, sep: str) -> Tuple[str, str, str]: ...
|
||||
def rsplit(self, sep: str = None, maxsplit: int = -1) -> List[str]: ...
|
||||
def rstrip(self, chars: str = None) -> str: ...
|
||||
def split(self, sep: str = None, maxsplit: int = -1) -> List[str]: ...
|
||||
def splitlines(self, keepends: bool = False) -> List[str]: ...
|
||||
def startswith(self, prefix: Union[str, Tuple[str, ...]], start: int = None,
|
||||
end: int = None) -> bool: ...
|
||||
def strip(self, chars: str = None) -> str: ...
|
||||
def swapcase(self) -> str: ...
|
||||
def title(self) -> str: ...
|
||||
def translate(self, table: Dict[int, Any]) -> str: ...
|
||||
def upper(self) -> str: ...
|
||||
def zfill(self, width: int) -> str: ...
|
||||
@staticmethod
|
||||
@overload
|
||||
def maketrans(self, x: Union[Dict[int, Any], Dict[str, Any]]) -> Dict[int, Any]: ...
|
||||
@staticmethod
|
||||
@overload
|
||||
def maketrans(self, x: str, y: str, z: str = ...) -> Dict[int, Any]: ...
|
||||
|
||||
def __getitem__(self, i: Union[int, slice]) -> str: ...
|
||||
def __add__(self, s: str) -> str: ...
|
||||
def __mul__(self, n: int) -> str: ...
|
||||
def __rmul__(self, n: int) -> str: ...
|
||||
def __mod__(self, *args: Any) -> str: ...
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __lt__(self, x: str) -> bool: ...
|
||||
def __le__(self, x: str) -> bool: ...
|
||||
def __gt__(self, x: str) -> bool: ...
|
||||
def __ge__(self, x: str) -> bool: ...
|
||||
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, s: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __str__(self) -> str: return self
|
||||
def __repr__(self) -> str: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class bytes(ByteString):
|
||||
@overload
|
||||
def __init__(self, ints: Iterable[int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, string: str, encoding: str,
|
||||
errors: str = 'strict') -> None: ...
|
||||
@overload
|
||||
def __init__(self, length: int) -> None: ...
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
def capitalize(self) -> bytes: ...
|
||||
def center(self, width: int, fillchar: bytes = None) -> bytes: ...
|
||||
def count(self, x: bytes) -> int: ...
|
||||
def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ...
|
||||
def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = 8) -> bytes: ...
|
||||
def find(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
|
||||
def index(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
def isalpha(self) -> bool: ...
|
||||
def isdigit(self) -> bool: ...
|
||||
def islower(self) -> bool: ...
|
||||
def isspace(self) -> bool: ...
|
||||
def istitle(self) -> bool: ...
|
||||
def isupper(self) -> bool: ...
|
||||
def join(self, iterable: Iterable[bytes]) -> bytes: ...
|
||||
def ljust(self, width: int, fillchar: bytes = None) -> bytes: ...
|
||||
def lower(self) -> bytes: ...
|
||||
def lstrip(self, chars: bytes = None) -> bytes: ...
|
||||
def partition(self, sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
|
||||
def replace(self, old: bytes, new: bytes, count: int = -1) -> bytes: ...
|
||||
def rfind(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
|
||||
def rindex(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
|
||||
def rjust(self, width: int, fillchar: bytes = None) -> bytes: ...
|
||||
def rpartition(self, sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
|
||||
def rsplit(self, sep: bytes = None, maxsplit: int = -1) -> List[bytes]: ...
|
||||
def rstrip(self, chars: bytes = None) -> bytes: ...
|
||||
def split(self, sep: bytes = None, maxsplit: int = -1) -> List[bytes]: ...
|
||||
def splitlines(self, keepends: bool = False) -> List[bytes]: ...
|
||||
def startswith(self, prefix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
|
||||
def strip(self, chars: bytes = None) -> bytes: ...
|
||||
def swapcase(self) -> bytes: ...
|
||||
def title(self) -> bytes: ...
|
||||
def translate(self, table: bytes) -> bytes: ...
|
||||
def upper(self) -> bytes: ...
|
||||
def zfill(self, width: int) -> bytes: ...
|
||||
# TODO fromhex
|
||||
# TODO maketrans
|
||||
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[int]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> bytes: ...
|
||||
def __add__(self, s: bytes) -> bytes: ...
|
||||
def __mul__(self, n: int) -> bytes: ...
|
||||
def __rmul__(self, n: int) -> bytes: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __lt__(self, x: bytes) -> bool: ...
|
||||
def __le__(self, x: bytes) -> bool: ...
|
||||
def __gt__(self, x: bytes) -> bool: ...
|
||||
def __ge__(self, x: bytes) -> bool: ...
|
||||
|
||||
class bytearray(MutableSequence[int], ByteString):
|
||||
@overload
|
||||
def __init__(self, ints: Iterable[int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, string: str, encoding: str, errors: str = 'strict') -> None: ...
|
||||
@overload
|
||||
def __init__(self, length: int) -> None: ...
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
def capitalize(self) -> bytearray: ...
|
||||
def center(self, width: int, fillchar: bytes = None) -> bytearray: ...
|
||||
def count(self, x: bytes) -> int: ...
|
||||
def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ...
|
||||
def endswith(self, suffix: bytes) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = 8) -> bytearray: ...
|
||||
def find(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
|
||||
def index(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
|
||||
def insert(self, index: int, object: int) -> None: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
def isalpha(self) -> bool: ...
|
||||
def isdigit(self) -> bool: ...
|
||||
def islower(self) -> bool: ...
|
||||
def isspace(self) -> bool: ...
|
||||
def istitle(self) -> bool: ...
|
||||
def isupper(self) -> bool: ...
|
||||
def join(self, iterable: Iterable[bytes]) -> bytearray: ...
|
||||
def ljust(self, width: int, fillchar: bytes = None) -> bytearray: ...
|
||||
def lower(self) -> bytearray: ...
|
||||
def lstrip(self, chars: bytes = None) -> bytearray: ...
|
||||
def partition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def replace(self, old: bytes, new: bytes, count: int = -1) -> bytearray: ...
|
||||
def rfind(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
|
||||
def rindex(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
|
||||
def rjust(self, width: int, fillchar: bytes = None) -> bytearray: ...
|
||||
def rpartition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def rsplit(self, sep: bytes = None, maxsplit: int = -1) -> List[bytearray]: ...
|
||||
def rstrip(self, chars: bytes = None) -> bytearray: ...
|
||||
def split(self, sep: bytes = None, maxsplit: int = -1) -> List[bytearray]: ...
|
||||
def splitlines(self, keepends: bool = False) -> List[bytearray]: ...
|
||||
def startswith(self, prefix: bytes) -> bool: ...
|
||||
def strip(self, chars: bytes = None) -> bytearray: ...
|
||||
def swapcase(self) -> bytearray: ...
|
||||
def title(self) -> bytearray: ...
|
||||
def translate(self, table: bytes) -> bytearray: ...
|
||||
def upper(self) -> bytearray: ...
|
||||
def zfill(self, width: int) -> bytearray: ...
|
||||
# TODO fromhex
|
||||
# TODO maketrans
|
||||
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[int]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> bytearray: ...
|
||||
@overload
|
||||
def __setitem__(self, i: int, x: int) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, x: Sequence[int]) -> None: ...
|
||||
def __delitem__(self, i: Union[int, slice]) -> None: ...
|
||||
def __add__(self, s: bytes) -> bytearray: ...
|
||||
# TODO: Mypy complains about __add__ and __iadd__ having different signatures.
|
||||
def __iadd__(self, s: Iterable[int]) -> bytearray: ... # type: ignore
|
||||
def __mul__(self, n: int) -> bytearray: ...
|
||||
def __rmul__(self, n: int) -> bytearray: ...
|
||||
def __imul__(self, n: int) -> bytearray: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __lt__(self, x: bytes) -> bool: ...
|
||||
def __le__(self, x: bytes) -> bool: ...
|
||||
def __gt__(self, x: bytes) -> bool: ...
|
||||
def __ge__(self, x: bytes) -> bool: ...
|
||||
|
||||
class memoryview():
|
||||
# TODO arg can be any obj supporting the buffer protocol
|
||||
def __init__(self, bytearray) -> None: ...
|
||||
|
||||
class bool(int, SupportsInt, SupportsFloat):
|
||||
def __init__(self, o: object = False) -> None: ...
|
||||
|
||||
class slice:
|
||||
start = 0
|
||||
step = 0
|
||||
stop = 0
|
||||
def __init__(self, start: int, stop: int = 0, step: int = 0) -> None: ...
|
||||
|
||||
class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
@overload
|
||||
def __getitem__(self, x: int) -> _T_co: ...
|
||||
@overload
|
||||
def __getitem__(self, x: slice) -> Tuple[_T_co, ...]: ...
|
||||
def __iter__(self) -> Iterator[_T_co]: ...
|
||||
def __lt__(self, x: Tuple[_T_co, ...]) -> bool: ...
|
||||
def __le__(self, x: Tuple[_T_co, ...]) -> bool: ...
|
||||
def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ...
|
||||
def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ...
|
||||
def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
|
||||
def __mul__(self, n: int) -> Tuple[_T_co, ...]: ...
|
||||
def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ...
|
||||
def count(self, x: Any) -> int: ...
|
||||
def index(self, x: Any) -> int: ...
|
||||
|
||||
class function:
|
||||
# TODO not defined in builtins!
|
||||
__name__ = ''
|
||||
__qualname__ = ''
|
||||
__module__ = ''
|
||||
__code__ = ... # type: Any
|
||||
|
||||
class list(MutableSequence[_T], Reversible[_T], Generic[_T]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def copy(self) -> List[_T]: ...
|
||||
def append(self, object: _T) -> None: ...
|
||||
def extend(self, iterable: Iterable[_T]) -> None: ...
|
||||
def pop(self, index: int = -1) -> _T: ...
|
||||
def index(self, object: _T, start: int = 0, stop: int = ...) -> int: ...
|
||||
def count(self, object: _T) -> int: ...
|
||||
def insert(self, index: int, object: _T) -> None: ...
|
||||
def remove(self, object: _T) -> None: ...
|
||||
def reverse(self) -> None: ...
|
||||
def sort(self, *, key: Callable[[_T], Any] = None, reverse: bool = False) -> None: ...
|
||||
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __hash__(self) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> List[_T]: ...
|
||||
@overload
|
||||
def __setitem__(self, i: int, o: _T) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Sequence[_T]) -> None: ...
|
||||
def __delitem__(self, i: Union[int, slice]) -> None: ...
|
||||
def __add__(self, x: List[_T]) -> List[_T]: ...
|
||||
def __iadd__(self, x: Iterable[_T]) -> List[_T]: ...
|
||||
def __mul__(self, n: int) -> List[_T]: ...
|
||||
def __rmul__(self, n: int) -> List[_T]: ...
|
||||
def __imul__(self, n: int) -> List[_T]: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __reversed__(self) -> Iterator[_T]: ...
|
||||
def __gt__(self, x: List[_T]) -> bool: ...
|
||||
def __ge__(self, x: List[_T]) -> bool: ...
|
||||
def __lt__(self, x: List[_T]) -> bool: ...
|
||||
def __le__(self, x: List[_T]) -> bool: ...
|
||||
|
||||
class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, map: Mapping[_KT, _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ... # TODO keyword args
|
||||
def clear(self) -> None: ...
|
||||
def copy(self) -> Dict[_KT, _VT]: ...
|
||||
def get(self, k: _KT, default: _VT = None) -> _VT: ...
|
||||
def pop(self, k: _KT, default: _VT = None) -> _VT: ...
|
||||
def popitem(self) -> Tuple[_KT, _VT]: ...
|
||||
def setdefault(self, k: _KT, default: _VT = None) -> _VT: ...
|
||||
def update(self, m: Union[Mapping[_KT, _VT],
|
||||
Iterable[Tuple[_KT, _VT]]]) -> None: ...
|
||||
def keys(self) -> KeysView[_KT]: ...
|
||||
def values(self) -> ValuesView[_VT]: ...
|
||||
def items(self) -> ItemsView[_KT, _VT]: ...
|
||||
@staticmethod
|
||||
@overload
|
||||
def fromkeys(seq: Sequence[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method
|
||||
@staticmethod
|
||||
@overload
|
||||
def fromkeys(seq: Sequence[_T], value: _S) -> Dict[_T, _S]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __getitem__(self, k: _KT) -> _VT: ...
|
||||
def __setitem__(self, k: _KT, v: _VT) -> None: ...
|
||||
def __delitem__(self, v: _KT) -> None: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
class set(MutableSet[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T]=None) -> None: ...
|
||||
def add(self, element: _T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def copy(self) -> set[_T]: ...
|
||||
def difference(self, s: Iterable[Any]) -> set[_T]: ...
|
||||
def difference_update(self, s: Iterable[Any]) -> None: ...
|
||||
def discard(self, element: _T) -> None: ...
|
||||
def intersection(self, s: Iterable[Any]) -> set[_T]: ...
|
||||
def intersection_update(self, s: Iterable[Any]) -> None: ...
|
||||
def isdisjoint(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def issubset(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def issuperset(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def pop(self) -> _T: ...
|
||||
def remove(self, element: _T) -> None: ...
|
||||
def symmetric_difference(self, s: Iterable[_T]) -> set[_T]: ...
|
||||
def symmetric_difference_update(self, s: Iterable[_T]) -> None: ...
|
||||
def union(self, s: Iterable[_T]) -> set[_T]: ...
|
||||
def update(self, s: Iterable[_T]) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __and__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __iand__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __or__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __ior__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __sub__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __isub__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __xor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __ixor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __le__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
# TODO more set operations
|
||||
|
||||
class frozenset(AbstractSet[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T]=None) -> None: ...
|
||||
def copy(self) -> frozenset[_T]: ...
|
||||
def difference(self, s: AbstractSet[Any]) -> frozenset[_T]: ...
|
||||
def intersection(self, s: AbstractSet[Any]) -> frozenset[_T]: ...
|
||||
def isdisjoint(self, s: AbstractSet[_T]) -> bool: ...
|
||||
def issubset(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def issuperset(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def symmetric_difference(self, s: AbstractSet[_T]) -> frozenset[_T]: ...
|
||||
def union(self, s: AbstractSet[_T]) -> frozenset[_T]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __and__(self, s: AbstractSet[_T]) -> frozenset[_T]: ...
|
||||
def __or__(self, s: AbstractSet[_S]) -> frozenset[Union[_T, _S]]: ...
|
||||
def __sub__(self, s: AbstractSet[_T]) -> frozenset[_T]: ...
|
||||
def __xor__(self, s: AbstractSet[_S]) -> frozenset[Union[_T, _S]]: ...
|
||||
def __le__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
|
||||
class enumerate(Iterator[Tuple[int, _T]], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T], start: int = 0) -> None: ...
|
||||
def __iter__(self) -> Iterator[Tuple[int, _T]]: ...
|
||||
def __next__(self) -> Tuple[int, _T]: ...
|
||||
# TODO __getattribute__
|
||||
|
||||
class range(Sequence[int], Reversible[int]):
|
||||
@overload
|
||||
def __init__(self, stop: int) -> None: ...
|
||||
@overload
|
||||
def __init__(self, start: int, stop: int, step: int = 1) -> None: ...
|
||||
def count(self, value: int) -> int: ...
|
||||
def index(self, value: int, start: int = 0, stop: int = None) -> int: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[int]: ...
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> range: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __reversed__(self) -> Iterator[int]: ...
|
||||
|
||||
class module:
|
||||
# TODO not defined in builtins!
|
||||
__name__ = ''
|
||||
__file__ = ''
|
||||
__dict__ = ... # type: Dict[str, Any]
|
||||
|
||||
True = ... # type: bool
|
||||
False = ... # type: bool
|
||||
__debug__ = False
|
||||
|
||||
NotImplemented = ... # type: Any
|
||||
|
||||
def abs(n: SupportsAbs[_T]) -> _T: ...
|
||||
def all(i: Iterable) -> bool: ...
|
||||
def any(i: Iterable) -> bool: ...
|
||||
def ascii(o: object) -> str: ...
|
||||
def bin(number: int) -> str: ...
|
||||
def callable(o: object) -> bool: ...
|
||||
def chr(code: int) -> str: ...
|
||||
def compile(source: Any, filename: Union[str, bytes], mode: str, flags: int = 0,
|
||||
dont_inherit: int = 0) -> Any: ...
|
||||
def copyright() -> None: ...
|
||||
def credits() -> None: ...
|
||||
def delattr(o: Any, name: str) -> None: ...
|
||||
def dir(o: object = None) -> List[str]: ...
|
||||
_N = TypeVar('_N', int, float)
|
||||
def divmod(a: _N, b: _N) -> Tuple[_N, _N]: ...
|
||||
def eval(source: str, globals: Dict[str, Any] = None,
|
||||
locals: Mapping[str, Any] = None) -> Any: ... # TODO code object as source
|
||||
def exec(object: str, globals: Dict[str, Any] = None,
|
||||
locals: Mapping[str, Any] = None) -> Any: ... # TODO code object as source
|
||||
def exit(code: int = None) -> None: ...
|
||||
def filter(function: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
def format(o: object, format_spec: str = '') -> str: ...
|
||||
def getattr(o: Any, name: str, default: Any = None) -> Any: ...
|
||||
def globals() -> Dict[str, Any]: ...
|
||||
def hasattr(o: Any, name: str) -> bool: ...
|
||||
def hash(o: object) -> int: ...
|
||||
def help(*args: Any, **kwds: Any) -> None: ...
|
||||
def hex(i: int) -> str: ... # TODO __index__
|
||||
def id(o: object) -> int: ...
|
||||
def input(prompt: str = None) -> str: ...
|
||||
@overload
|
||||
def iter(iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def iter(function: Callable[[], _T], sentinel: _T) -> Iterator[_T]: ...
|
||||
def isinstance(o: object, t: Union[type, Tuple[type, ...]]) -> bool: ...
|
||||
def issubclass(cls: type, classinfo: type) -> bool: ...
|
||||
# TODO support this
|
||||
#def issubclass(type cld, classinfo: Sequence[type]) -> bool: ...
|
||||
def len(o: Union[Sized, tuple]) -> int: ...
|
||||
def license() -> None: ...
|
||||
def locals() -> Dict[str, Any]: ...
|
||||
@overload
|
||||
def map(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ...
|
||||
@overload
|
||||
def map(func: Callable[[_T1, _T2], _S], iter1: Iterable[_T1],
|
||||
iter2: Iterable[_T2]) -> Iterator[_S]: ... # TODO more than two iterables
|
||||
@overload
|
||||
def max(iterable: Iterable[_T]) -> _T: ... # TODO keyword argument key
|
||||
@overload
|
||||
def max(arg1: _T, arg2: _T, *args: _T) -> _T: ...
|
||||
# TODO memoryview
|
||||
@overload
|
||||
def min(iterable: Iterable[_T]) -> _T: ...
|
||||
@overload
|
||||
def min(arg1: _T, arg2: _T, *args: _T) -> _T: ...
|
||||
@overload
|
||||
def next(i: Iterator[_T]) -> _T: ...
|
||||
@overload
|
||||
def next(i: Iterator[_T], default: _T) -> _T: ...
|
||||
def oct(i: int) -> str: ... # TODO __index__
|
||||
def open(file: Union[str, bytes, int], mode: str = 'r', buffering: int = -1, encoding: str = None,
|
||||
errors: str = None, newline: str = None, closefd: bool = True) -> IO[Any]: ...
|
||||
def ord(c: Union[str, bytes, bytearray]) -> int: ...
|
||||
def print(*values: Any, sep: str = ' ', end: str = '\n', file: IO[str] = None) -> None: ...
|
||||
@overload
|
||||
def pow(x: int, y: int) -> Any: ... # The return type can be int or float, depending on y
|
||||
@overload
|
||||
def pow(x: int, y: int, z: int) -> Any: ...
|
||||
@overload
|
||||
def pow(x: float, y: float) -> float: ...
|
||||
@overload
|
||||
def pow(x: float, y: float, z: float) -> float: ...
|
||||
def quit(code: int = None) -> None: ...
|
||||
@overload
|
||||
def reversed(object: Reversible[_T]) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def reversed(object: Sequence[_T]) -> Iterator[_T]: ...
|
||||
def repr(o: object) -> str: ...
|
||||
@overload
|
||||
def round(number: float) -> int: ...
|
||||
@overload
|
||||
def round(number: float, ndigits: int) -> float: ... # Always return a float if given ndigits.
|
||||
@overload
|
||||
def round(number: SupportsRound[_T]) -> _T: ...
|
||||
@overload
|
||||
def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
|
||||
def setattr(object: Any, name: str, value: Any) -> None: ...
|
||||
def sorted(iterable: Iterable[_T], *, key: Callable[[_T], Any] = None,
|
||||
reverse: bool = False) -> List[_T]: ...
|
||||
def sum(iterable: Iterable[_T], start: _T = None) -> _T: ...
|
||||
def vars(object: Any = None) -> Dict[str, Any]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2,
|
||||
_T3, _T4]]: ... # TODO more than four iterables
|
||||
def __import__(name: str, globals: Dict[str, Any] = {}, locals: Dict[str, Any] = {},
|
||||
fromlist: List[str] = [], level: int = -1) -> Any: ...
|
||||
|
||||
# Ellipsis
|
||||
|
||||
class ellipsis:
|
||||
# TODO not defined in builtins!
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
Ellipsis = ellipsis()
|
||||
|
||||
# Exceptions
|
||||
|
||||
class BaseException:
|
||||
args = ... # type: Any
|
||||
def __init__(self, *args: Any) -> None: ...
|
||||
def with_traceback(self, tb: Any) -> BaseException: ...
|
||||
|
||||
class GeneratorExit(BaseException): ...
|
||||
class KeyboardInterrupt(BaseException): ...
|
||||
class SystemExit(BaseException):
|
||||
code = 0
|
||||
class Exception(BaseException): ...
|
||||
class ArithmeticError(Exception): ...
|
||||
class EnvironmentError(Exception):
|
||||
errno = 0
|
||||
strerror = ''
|
||||
filename = '' # TODO can this be bytes?
|
||||
class LookupError(Exception): ...
|
||||
class RuntimeError(Exception): ...
|
||||
class ValueError(Exception): ...
|
||||
class AssertionError(Exception): ...
|
||||
class AttributeError(Exception): ...
|
||||
class BufferError(Exception): ...
|
||||
class EOFError(Exception): ...
|
||||
class FloatingPointError(ArithmeticError): ...
|
||||
class IOError(EnvironmentError): ...
|
||||
class ImportError(Exception): ...
|
||||
class IndexError(LookupError): ...
|
||||
class KeyError(LookupError): ...
|
||||
class MemoryError(Exception): ...
|
||||
class NameError(Exception): ...
|
||||
class NotImplementedError(RuntimeError): ...
|
||||
class OSError(EnvironmentError): ...
|
||||
class BlockingIOError(OSError):
|
||||
characters_written = 0
|
||||
class ChildProcessError(OSError): ...
|
||||
class ConnectionError(OSError): ...
|
||||
class BrokenPipeError(ConnectionError): ...
|
||||
class ConnectionAbortedError(ConnectionError): ...
|
||||
class ConnectionRefusedError(ConnectionError): ...
|
||||
class ConnectionResetError(ConnectionError): ...
|
||||
class FileExistsError(OSError): ...
|
||||
class FileNotFoundError(OSError): ...
|
||||
class InterruptedError(OSError): ...
|
||||
class IsADirectoryError(OSError): ...
|
||||
class NotADirectoryError(OSError): ...
|
||||
class PermissionError(OSError): ...
|
||||
class ProcessLookupError(OSError): ...
|
||||
class TimeoutError(OSError): ...
|
||||
class WindowsError(OSError): ...
|
||||
class OverflowError(ArithmeticError): ...
|
||||
class ReferenceError(Exception): ...
|
||||
class StopIteration(Exception): ...
|
||||
class SyntaxError(Exception): ...
|
||||
class IndentationError(SyntaxError): ...
|
||||
class TabError(IndentationError): ...
|
||||
class SystemError(Exception): ...
|
||||
class TypeError(Exception): ...
|
||||
class UnboundLocalError(NameError): ...
|
||||
class UnicodeError(ValueError): ...
|
||||
class UnicodeDecodeError(UnicodeError):
|
||||
encoding = ... # type: str
|
||||
object = ... # type: bytes
|
||||
start = ... # type: int
|
||||
end = ... # type: int
|
||||
reason = ... # type: str
|
||||
def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int,
|
||||
__reason: str) -> None: ...
|
||||
class UnicodeEncodeError(UnicodeError): ...
|
||||
class UnicodeTranslateError(UnicodeError): ...
|
||||
class ZeroDivisionError(ArithmeticError): ...
|
||||
|
||||
class Warning(Exception): ...
|
||||
class UserWarning(Warning): ...
|
||||
class DeprecationWarning(Warning): ...
|
||||
class SyntaxWarning(Warning): ...
|
||||
class RuntimeWarning(Warning): ...
|
||||
class FutureWarning(Warning): ...
|
||||
class PendingDeprecationWarning(Warning): ...
|
||||
class ImportWarning(Warning): ...
|
||||
class UnicodeWarning(Warning): ...
|
||||
class BytesWarning(Warning): ...
|
||||
class ResourceWarning(Warning): ...
|
||||
@@ -0,0 +1,15 @@
|
||||
# Stubs for calendar
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import overload, Tuple
|
||||
|
||||
# TODO actually, any number of items larger than 5 is fine
|
||||
@overload
|
||||
def timegm(t: Tuple[int, int, int, int, int, int]) -> int: ...
|
||||
@overload
|
||||
def timegm(t: Tuple[int, int, int, int, int, int, int]) -> int: ...
|
||||
@overload
|
||||
def timegm(t: Tuple[int, int, int, int, int, int, int, int]) -> int: ...
|
||||
@overload
|
||||
def timegm(t: Tuple[int, int, int, int, int, int, int, int, int]) -> int: ...
|
||||
@@ -0,0 +1 @@
|
||||
def escape(s: str) -> str: ...
|
||||
@@ -0,0 +1,31 @@
|
||||
from typing import Any, BinaryIO, Callable, IO
|
||||
|
||||
BOM_UTF8 = b''
|
||||
|
||||
class Codec: ...
|
||||
class StreamWriter(Codec): ...
|
||||
|
||||
class CodecInfo(tuple):
|
||||
def __init__(self, *args) -> None: ...
|
||||
|
||||
def register(search_function: Callable[[str], CodecInfo]) -> None:
|
||||
...
|
||||
|
||||
def register_error(name: str, error_handler: Callable[[UnicodeError], Any]) -> None: ...
|
||||
|
||||
def lookup(encoding: str) -> CodecInfo:
|
||||
...
|
||||
|
||||
# TODO This Callable is actually a StreamWriter constructor
|
||||
def getwriter(encoding: str) -> Callable[[BinaryIO], StreamWriter]: ...
|
||||
|
||||
class IncrementalDecoder:
|
||||
errors = ... # type: Any
|
||||
def __init__(self, errors=''): ...
|
||||
def decode(self, input, final=False): ...
|
||||
def reset(self): ...
|
||||
def getstate(self): ...
|
||||
def setstate(self, state): ...
|
||||
|
||||
def open(filename: str, mode: str='rb', encoding: str=None, errors: str='strict', buffering: int=1) -> IO[Any]:
|
||||
...
|
||||
@@ -0,0 +1,112 @@
|
||||
# Stubs for collections
|
||||
|
||||
# Based on http://docs.python.org/3.2/library/collections.html
|
||||
|
||||
# TODO UserDict
|
||||
# TODO UserList
|
||||
# TODO UserString
|
||||
# TODO more abstract base classes (interfaces in mypy)
|
||||
|
||||
from typing import (
|
||||
TypeVar, Iterable, Generic, Iterator, Dict, overload,
|
||||
Mapping, List, Tuple, Callable, Set, Sequence, Sized,
|
||||
Optional, Union
|
||||
)
|
||||
import typing
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_KT = TypeVar('_KT')
|
||||
_VT = TypeVar('_VT')
|
||||
|
||||
|
||||
# namedtuple is special-cased in the type checker; the initializer is ignored.
|
||||
namedtuple = object()
|
||||
|
||||
|
||||
MutableMapping = typing.MutableMapping
|
||||
|
||||
|
||||
class deque(Sized, Iterable[_T], Generic[_T]):
|
||||
maxlen = 0 # type: Optional[int] # TODO readonly
|
||||
def __init__(self, iterable: Iterable[_T] = None,
|
||||
maxlen: int = None) -> None: ...
|
||||
def append(self, x: _T) -> None: ...
|
||||
def appendleft(self, x: _T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def count(self, x: _T) -> int: ...
|
||||
def extend(self, iterable: Iterable[_T]) -> None: ...
|
||||
def extendleft(self, iterable: Iterable[_T]) -> None: ...
|
||||
def pop(self) -> _T: ...
|
||||
def popleft(self) -> _T: ...
|
||||
def remove(self, value: _T) -> None: ...
|
||||
def reverse(self) -> None: ...
|
||||
def rotate(self, n: int) -> None: ...
|
||||
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
def __setitem__(self, i: int, x: _T) -> None: ...
|
||||
def __contains__(self, o: _T) -> bool: ...
|
||||
|
||||
# TODO __reversed__
|
||||
|
||||
|
||||
class Counter(Dict[_T, int], Generic[_T]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, Mapping: Mapping[_T, int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
# TODO keyword arguments
|
||||
|
||||
def elements(self) -> Iterator[_T]: ...
|
||||
|
||||
@overload
|
||||
def most_common(self) -> List[_T]: ...
|
||||
@overload
|
||||
def most_common(self, n: int) -> List[_T]: ...
|
||||
|
||||
@overload
|
||||
def subtract(self, Mapping: Mapping[_T, int]) -> None: ...
|
||||
@overload
|
||||
def subtract(self, iterable: Iterable[_T]) -> None: ...
|
||||
|
||||
# The Iterable[Tuple[...]] argument type is not actually desirable
|
||||
# (the tuples will be added as keys, breaking type safety) but
|
||||
# it's included so that the signature is compatible with
|
||||
# Dict.update. Not sure if we should use '# type: ignore' instead
|
||||
# and omit the type from the union.
|
||||
def update(self, m: Union[Mapping[_T, int],
|
||||
Iterable[Tuple[_T, int]],
|
||||
Iterable[_T]]) -> None: ...
|
||||
|
||||
class OrderedDict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
def popitem(self, last: bool = True) -> Tuple[_KT, _VT]: ...
|
||||
def move_to_end(self, key: _KT, last: bool = True) -> None: ...
|
||||
|
||||
|
||||
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
default_factory = ... # type: Callable[[], _VT]
|
||||
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, map: Mapping[_KT, _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Callable[[], _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Callable[[], _VT],
|
||||
map: Mapping[_KT, _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Callable[[], _VT],
|
||||
iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
|
||||
# TODO __init__ keyword args
|
||||
|
||||
def __missing__(self, key: _KT) -> _VT: ...
|
||||
# TODO __reversed__
|
||||
@@ -0,0 +1,8 @@
|
||||
# Stubs for contextlib
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import Any
|
||||
|
||||
# TODO more precise type?
|
||||
def contextmanager(func: Any) -> Any: ...
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user