add (overwrite with) mypy stubs, if available

This commit is contained in:
Matthias Kramm
2015-09-30 07:36:12 -07:00
parent 69e10b3aed
commit 337abed05a
432 changed files with 22360 additions and 776 deletions

29
stdlib/2.7/Queue.pyi Normal file
View File

@@ -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): ...

28
stdlib/2.7/StringIO.pyi Normal file
View File

@@ -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: ...

11
stdlib/2.7/UserDict.pyi Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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: ...

View File

@@ -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

5
stdlib/2.7/abc.pyi Normal file
View File

@@ -0,0 +1,5 @@
# Stubs for abc.
# Thesee definitions have special processing in type checker.
class ABCMeta: ...
abstractmethod = object()

171
stdlib/2.7/argparse.pyi Normal file
View File

@@ -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): ...

5
stdlib/2.7/atexit.pyi Normal file
View File

@@ -0,0 +1,5 @@
from typing import TypeVar, Any
_FT = TypeVar('_FT')
def register(func: _FT, *args: Any, **kargs: Any) -> _FT: ...

25
stdlib/2.7/base64.pyi Normal file
View File

@@ -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: ...

165
stdlib/2.7/codecs.pyi Normal file
View File

@@ -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

View File

@@ -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: ...

View File

@@ -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): ...

View File

@@ -0,0 +1,8 @@
# Stubs for contextlib
# NOTE: These are incomplete!
from typing import Any
# TODO more precise type?
def contextmanager(func: Any) -> Any: ...

10
stdlib/2.7/copy.pyi Normal file
View File

@@ -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: ...

93
stdlib/2.7/csv.pyi Normal file
View File

@@ -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: ...

View File

@@ -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]: ...

63
stdlib/2.7/difflib.pyi Normal file
View File

@@ -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]: ...

View File

@@ -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

View File

@@ -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): ...

View File

@@ -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=''): ...

View File

View File

View File

@@ -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): ...

View File

@@ -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): ...

View File

@@ -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): ...

View File

@@ -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=''): ...

6
stdlib/2.7/fnmatch.pyi Normal file
View File

@@ -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]: ...

23
stdlib/2.7/functools.pyi Normal file
View File

@@ -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: ...

8
stdlib/2.7/getpass.pyi Normal file
View File

@@ -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: ...

40
stdlib/2.7/gettext.pyi Normal file
View File

@@ -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: ...

4
stdlib/2.7/glob.pyi Normal file
View File

@@ -0,0 +1,4 @@
from typing import List, Iterator, AnyStr
def glob(pathname: AnyStr) -> List[AnyStr]: ...
def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ...

41
stdlib/2.7/gzip.pyi Normal file
View File

@@ -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: ...

27
stdlib/2.7/hashlib.pyi Normal file
View File

@@ -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: ...

11
stdlib/2.7/hmac.pyi Normal file
View File

@@ -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: ...

View File

@@ -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]

3
stdlib/2.7/importlib.pyi Normal file
View File

@@ -0,0 +1,3 @@
import types
def import_module(name: str, package: str = None) -> types.ModuleType: ...

11
stdlib/2.7/inspect.pyi Normal file
View File

@@ -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]: ...

101
stdlib/2.7/io.pyi Normal file
View File

@@ -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): ...

12
stdlib/2.7/json.pyi Normal file
View File

@@ -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: ...

View File

@@ -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: ...

View File

@@ -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): ...

11
stdlib/2.7/md5.pyi Normal file
View File

@@ -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

77
stdlib/2.7/numbers.pyi Normal file
View File

@@ -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): ...

184
stdlib/2.7/os/__init__.pyi Normal file
View File

@@ -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: ...

65
stdlib/2.7/os/path.pyi Normal file
View File

@@ -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: ...

8
stdlib/2.7/pickle.pyi Normal file
View File

@@ -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: ...

13
stdlib/2.7/pipes.pyi Normal file
View File

@@ -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: ...

21
stdlib/2.7/pprint.pyi Normal file
View File

@@ -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): ...

79
stdlib/2.7/random.pyi Normal file
View File

@@ -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: ...

63
stdlib/2.7/re.pyi Normal file
View File

@@ -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: ...

12
stdlib/2.7/sha.pyi Normal file
View File

@@ -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

27
stdlib/2.7/shlex.pyi Normal file
View File

@@ -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]

30
stdlib/2.7/shutil.pyi Normal file
View File

@@ -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: ...

12
stdlib/2.7/simplejson.pyi Normal file
View File

@@ -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: ...

90
stdlib/2.7/smtplib.pyi Normal file
View File

@@ -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): ...

388
stdlib/2.7/socket.pyi Normal file
View File

@@ -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: ...

58
stdlib/2.7/stat.pyi Normal file
View File

@@ -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

74
stdlib/2.7/string.pyi Normal file
View File

@@ -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: ...

28
stdlib/2.7/struct.pyi Normal file
View File

@@ -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, ...]: ...

79
stdlib/2.7/subprocess.pyi Normal file
View File

@@ -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

237
stdlib/2.7/tarfile.pyi Normal file
View File

@@ -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): ...

42
stdlib/2.7/tempfile.pyi Normal file
View File

@@ -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: ...

33
stdlib/2.7/textwrap.pyi Normal file
View File

@@ -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): ...

98
stdlib/2.7/threading.pyi Normal file
View File

@@ -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: ...

16
stdlib/2.7/traceback.pyi Normal file
View File

@@ -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: ...

20
stdlib/2.7/types.pyi Normal file
View File

@@ -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:
...

299
stdlib/2.7/typing.pyi Normal file
View File

@@ -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]: ...

134
stdlib/2.7/urllib.pyi Normal file
View File

@@ -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

47
stdlib/2.7/urlparse.pyi Normal file
View File

@@ -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]]: ...

36
stdlib/2.7/uuid.pyi Normal file
View File

@@ -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

View File

View File

View File

@@ -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

View File

@@ -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=''): ...

View File

@@ -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): ...