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

9
stdlib/3/__future__.pyi Normal file
View File

@@ -0,0 +1,9 @@
class _Feature: ...
absolute_import = ... # type: _Feature
division = ... # type: _Feature
generators = ... # type: _Feature
nested_scopes = ... # type: _Feature
print_function = ... # type: _Feature
unicode_literals = ... # type: _Feature
with_statement = ... # type: _Feature

View File

@@ -0,0 +1,11 @@
# Stubs for _dummy_thread
# NOTE: These are incomplete!
from typing import Any
class LockType:
def acquire(self) -> None: ...
def release(self) -> None: ...
def allocate_lock() -> LockType: ...

View File

@@ -0,0 +1,13 @@
# Stubs for _posixsubprocess
# NOTE: These are incomplete!
from typing import Tuple, Sequence
def cloexec_pipe() -> Tuple[int, int]: ...
def fork_exec(args: Sequence[str],
executable_list, close_fds, fds_to_keep, cwd: str, env_list,
p2cread: int, p2cwrite: int, c2pred: int, c2pwrite: int,
errread: int, errwrite: int, errpipe_read: int,
errpipe_write: int, restore_signals, start_new_session,
preexec_fn) -> int: ...

38
stdlib/3/_subprocess.pyi Normal file
View File

@@ -0,0 +1,38 @@
# Stubs for _subprocess
# NOTE: These are incomplete!
from typing import Mapping, Any, Tuple
CREATE_NEW_CONSOLE = 0
CREATE_NEW_PROCESS_GROUP = 0
STD_INPUT_HANDLE = 0
STD_OUTPUT_HANDLE = 0
STD_ERROR_HANDLE = 0
SW_HIDE = 0
STARTF_USESTDHANDLES = 0
STARTF_USESHOWWINDOW = 0
INFINITE = 0
DUPLICATE_SAME_ACCESS = 0
WAIT_OBJECT_0 = 0
# TODO not exported by the Python module
class Handle:
def Close(self) -> None: ...
def GetVersion() -> int: ...
def GetExitCodeProcess(handle: Handle) -> int: ...
def WaitForSingleObject(handle: Handle, timeout: int) -> int: ...
def CreateProcess(executable: str, cmd_line: str,
proc_attrs, thread_attrs,
inherit: int, flags: int,
env_mapping: Mapping[str, str],
curdir: str,
startupinfo: Any) -> Tuple[Any, Handle, int, int]: ...
def GetModuleFileName(module: int) -> str: ...
def GetCurrentProcess() -> Handle: ...
def DuplicateHandle(source_proc: Handle, source: Handle, target_proc: Handle,
target: Any, access: int, inherit: int) -> int: ...
def CreatePipe(pipe_attrs, size: int) -> Tuple[Handle, Handle]: ...
def GetStdHandle(arg: int) -> int: ...
def TerminateProcess(handle: Handle, exit_code: int) -> None: ...

14
stdlib/3/_thread.pyi Normal file
View File

@@ -0,0 +1,14 @@
# Stubs for _thread
# NOTE: These are incomplete!
from typing import Any
def _count() -> int: ...
_dangling = ... # type: Any
class LockType:
def acquire(self) -> None: ...
def release(self) -> None: ...
def allocate_lock() -> LockType: ...

5
stdlib/3/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()

161
stdlib/3/argparse.pyi Normal file
View File

@@ -0,0 +1,161 @@
# Stubs for argparse (Python 3)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, Sequence
SUPPRESS = ... # type: Any
OPTIONAL = ... # type: Any
ZERO_OR_MORE = ... # type: Any
ONE_OR_MORE = ... # type: Any
PARSER = ... # type: Any
REMAINDER = ... # type: Any
class _AttributeHolder: ...
class HelpFormatter:
def __init__(self, prog, indent_increment=2, max_help_position=24, width=None): ...
def start_section(self, heading): ...
def end_section(self): ...
def add_text(self, text): ...
def add_usage(self, usage, actions, groups, prefix=None): ...
def add_argument(self, action): ...
def add_arguments(self, actions): ...
def format_help(self): ...
class RawDescriptionHelpFormatter(HelpFormatter): ...
class RawTextHelpFormatter(RawDescriptionHelpFormatter): ...
class ArgumentDefaultsHelpFormatter(HelpFormatter): ...
class MetavarTypeHelpFormatter(HelpFormatter): ...
class ArgumentError(Exception):
argument_name = ... # type: Any
message = ... # type: Any
def __init__(self, argument, message): ...
class ArgumentTypeError(Exception): ...
class Action(_AttributeHolder):
option_strings = ... # type: Any
dest = ... # type: Any
nargs = ... # type: Any
const = ... # type: Any
default = ... # type: Any
type = ... # type: Any
choices = ... # type: Any
required = ... # type: Any
help = ... # type: Any
metavar = ... # type: Any
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None,
choices=None, required=False, help=None, metavar=None): ...
def __call__(self, parser, namespace, values, option_string=None): ...
class _StoreAction(Action):
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None,
choices=None, required=False, help=None, metavar=None): ...
def __call__(self, parser, namespace, values, option_string=None): ...
class _StoreConstAction(Action):
def __init__(self, option_strings, dest, const, default=None, required=False, help=None,
metavar=None): ...
def __call__(self, parser, namespace, values, option_string=None): ...
class _StoreTrueAction(_StoreConstAction):
def __init__(self, option_strings, dest, default=False, required=False, help=None): ...
class _StoreFalseAction(_StoreConstAction):
def __init__(self, option_strings, dest, default=True, required=False, help=None): ...
class _AppendAction(Action):
def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None,
choices=None, required=False, help=None, metavar=None): ...
def __call__(self, parser, namespace, values, option_string=None): ...
class _AppendConstAction(Action):
def __init__(self, option_strings, dest, const, default=None, required=False, help=None,
metavar=None): ...
def __call__(self, parser, namespace, values, option_string=None): ...
class _CountAction(Action):
def __init__(self, option_strings, dest, default=None, required=False, help=None): ...
def __call__(self, parser, namespace, values, option_string=None): ...
class _HelpAction(Action):
def __init__(self, option_strings, dest=..., default=..., help=None): ...
def __call__(self, parser, namespace, values, option_string=None): ...
class _VersionAction(Action):
version = ... # type: Any
def __init__(self, option_strings, version=None, dest=..., default=...,
help=''): ...
def __call__(self, parser, namespace, values, option_string=None): ...
class _SubParsersAction(Action):
def __init__(self, option_strings, prog, parser_class, dest=..., help=None,
metavar=None): ...
def add_parser(self, name, **kwargs): ...
def __call__(self, parser, namespace, values, option_string=None): ...
class FileType:
def __init__(self, mode='', bufsize=-1, encoding=None, errors=None): ...
def __call__(self, string): ...
class Namespace(_AttributeHolder):
def __init__(self, **kwargs): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __contains__(self, key): ...
class _ActionsContainer:
description = ... # type: Any
argument_default = ... # type: Any
prefix_chars = ... # type: Any
conflict_handler = ... # type: Any
def __init__(self, description, prefix_chars, argument_default, conflict_handler): ...
def register(self, registry_name, value, object): ...
def set_defaults(self, **kwargs): ...
def get_default(self, dest): ...
def add_argument(self,
*args: str,
action: str = None,
nargs: str = None,
const: Any = None,
default: Any = None,
type: Any = None,
choices: Any = None, # TODO: Container?
required: bool = None,
help: str = None,
metavar: str = None,
dest: str = None,
) -> None: ...
def add_argument_group(self, *args, **kwargs): ...
def add_mutually_exclusive_group(self, **kwargs): ...
class _ArgumentGroup(_ActionsContainer):
title = ... # type: Any
def __init__(self, container, title=None, description=None, **kwargs): ...
class _MutuallyExclusiveGroup(_ArgumentGroup):
required = ... # type: Any
def __init__(self, container, required=False): ...
class ArgumentParser(_AttributeHolder, _ActionsContainer):
prog = ... # type: Any
usage = ... # type: Any
epilog = ... # type: Any
formatter_class = ... # type: Any
fromfile_prefix_chars = ... # type: Any
add_help = ... # type: Any
def __init__(self, prog=None, usage=None, description=None, epilog=None, parents=...,
formatter_class=..., prefix_chars='', fromfile_prefix_chars=None,
argument_default=None, conflict_handler='', add_help=True): ...
def add_subparsers(self, **kwargs): ...
def parse_args(self, args: Sequence[str] = None, namespace=None) -> Any: ...
def parse_known_args(self, args=None, namespace=None): ...
def convert_arg_line_to_args(self, arg_line): ...
def format_usage(self): ...
def format_help(self): ...
def print_usage(self, file=None): ...
def print_help(self, file=None): ...
def exit(self, status=0, message=None): ...
def error(self, message): ...

5
stdlib/3/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/3/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: bytes, altchars: bytes = None) -> bytes: ...
def b64decode(s: bytes, altchars: bytes = None,
validate: bool = False) -> bytes: ...
def standard_b64encode(s: bytes) -> bytes: ...
def standard_b64decode(s: bytes) -> bytes: ...
def urlsafe_b64encode(s: bytes) -> bytes: ...
def urlsafe_b64decode(s: bytes) -> bytes: ...
def b32encode(s: bytes) -> bytes: ...
def b32decode(s: bytes, casefold: bool = False,
map01: bytes = None) -> bytes: ...
def b16encode(s: bytes) -> bytes: ...
def b16decode(s: bytes, casefold: bool = False) -> bytes: ...
def decode(input: IO[bytes], output: IO[bytes]) -> None: ...
def decodebytes(s: bytes) -> bytes: ...
def decodestring(s: bytes) -> bytes: ...
def encode(input: IO[bytes], output: IO[bytes]) -> None: ...
def encodebytes(s: bytes) -> bytes: ...
def encodestring(s: bytes) -> bytes: ...

801
stdlib/3/builtins.pyi Normal file
View File

@@ -0,0 +1,801 @@
# Stubs for builtins (Python 3)
from typing import (
TypeVar, Iterator, Iterable, overload,
Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic,
Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString
)
from abc import abstractmethod, ABCMeta
# Note that names imported above are not automatically made visible via the
# implicit builtins import.
_T = TypeVar('_T')
_T_co = TypeVar('_T_co', covariant=True)
_KT = TypeVar('_KT')
_VT = TypeVar('_VT')
_S = TypeVar('_S')
_T1 = TypeVar('_T1')
_T2 = TypeVar('_T2')
_T3 = TypeVar('_T3')
_T4 = TypeVar('_T4')
staticmethod = object() # Only valid as a decorator.
classmethod = object() # Only valid as a decorator.
property = object()
class object:
__doc__ = ''
__class__ = ... # type: type
def __init__(self) -> None: ...
def __eq__(self, o: object) -> bool: ...
def __ne__(self, o: object) -> bool: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __hash__(self) -> int: ...
class type:
__name__ = ''
__qualname__ = ''
__module__ = ''
__dict__ = ... # type: Dict[str, Any]
def __init__(self, o: object) -> None: ...
@staticmethod
def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ...
class int(SupportsInt, SupportsFloat, SupportsAbs[int]):
def __init__(self, x: Union[SupportsInt, str, bytes] = None, base: int = None) -> None: ...
def bit_length(self) -> int: ...
def to_bytes(self, length: int, byteorder: str, *, signed: bool = False) -> bytes: ...
@classmethod
def from_bytes(cls, bytes: Sequence[int], byteorder: str, *,
signed: bool = False) -> int: ... # TODO buffer object argument
def __add__(self, x: int) -> int: ...
def __sub__(self, x: int) -> int: ...
def __mul__(self, x: int) -> int: ...
def __floordiv__(self, x: int) -> int: ...
def __truediv__(self, x: int) -> float: ...
def __mod__(self, x: int) -> int: ...
def __radd__(self, x: int) -> int: ...
def __rsub__(self, x: int) -> int: ...
def __rmul__(self, x: int) -> int: ...
def __rfloordiv__(self, x: int) -> int: ...
def __rtruediv__(self, x: int) -> float: ...
def __rmod__(self, x: int) -> int: ...
def __pow__(self, x: int) -> Any: ... # Return type can be int or float, depending on x.
def __rpow__(self, x: int) -> Any: ...
def __and__(self, n: int) -> int: ...
def __or__(self, n: int) -> int: ...
def __xor__(self, n: int) -> int: ...
def __lshift__(self, n: int) -> int: ...
def __rshift__(self, n: int) -> int: ...
def __rand__(self, n: int) -> int: ...
def __ror__(self, n: int) -> int: ...
def __rxor__(self, n: int) -> int: ...
def __rlshift__(self, n: int) -> int: ...
def __rrshift__(self, n: int) -> int: ...
def __neg__(self) -> int: ...
def __pos__(self) -> int: ...
def __invert__(self) -> int: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: int) -> bool: ...
def __le__(self, x: int) -> bool: ...
def __gt__(self, x: int) -> bool: ...
def __ge__(self, x: int) -> bool: ...
def __str__(self) -> str: ...
def __float__(self) -> float: ...
def __int__(self) -> int: return self
def __abs__(self) -> int: ...
def __hash__(self) -> int: ...
class float(SupportsFloat, SupportsInt, SupportsAbs[float]):
def __init__(self, x: Union[SupportsFloat, str, bytes]=None) -> None: ...
def as_integer_ratio(self) -> Tuple[int, int]: ...
def hex(self) -> str: ...
def is_integer(self) -> bool: ...
@classmethod
def fromhex(cls, s: str) -> float: ...
def __add__(self, x: float) -> float: ...
def __sub__(self, x: float) -> float: ...
def __mul__(self, x: float) -> float: ...
def __floordiv__(self, x: float) -> float: ...
def __truediv__(self, x: float) -> float: ...
def __mod__(self, x: float) -> float: ...
def __pow__(self, x: float) -> float: ...
def __radd__(self, x: float) -> float: ...
def __rsub__(self, x: float) -> float: ...
def __rmul__(self, x: float) -> float: ...
def __rfloordiv__(self, x: float) -> float: ...
def __rtruediv__(self, x: float) -> float: ...
def __rmod__(self, x: float) -> float: ...
def __rpow__(self, x: float) -> float: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: float) -> bool: ...
def __le__(self, x: float) -> bool: ...
def __gt__(self, x: float) -> bool: ...
def __ge__(self, x: float) -> bool: ...
def __neg__(self) -> float: ...
def __pos__(self) -> float: ...
def __str__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __abs__(self) -> float: ...
def __hash__(self) -> int: ...
class complex(SupportsAbs[float]):
@overload
def __init__(self, re: float = 0.0, im: float = 0.0) -> None: ...
@overload
def __init__(self, s: str) -> None: ...
@property
def real(self) -> float: ...
@property
def imag(self) -> float: ...
def conjugate(self) -> complex: ...
def __add__(self, x: complex) -> complex: ...
def __sub__(self, x: complex) -> complex: ...
def __mul__(self, x: complex) -> complex: ...
def __pow__(self, x: complex) -> complex: ...
def __truediv__(self, x: complex) -> complex: ...
def __radd__(self, x: complex) -> complex: ...
def __rsub__(self, x: complex) -> complex: ...
def __rmul__(self, x: complex) -> complex: ...
def __rpow__(self, x: complex) -> complex: ...
def __rtruediv__(self, x: complex) -> complex: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __neg__(self) -> complex: ...
def __pos__(self) -> complex: ...
def __str__(self) -> str: ...
def __abs__(self) -> float: ...
def __hash__(self) -> int: ...
class str(Sequence[str]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, o: object) -> None: ...
@overload
def __init__(self, o: bytes, encoding: str = None, errors: str = 'strict') -> None: ...
def capitalize(self) -> str: ...
def center(self, width: int, fillchar: str = ' ') -> str: ...
def count(self, x: str) -> int: ...
def encode(self, encoding: str = 'utf-8', errors: str = 'strict') -> bytes: ...
def endswith(self, suffix: Union[str, Tuple[str, ...]], start: int = None,
end: int = None) -> bool: ...
def expandtabs(self, tabsize: int = 8) -> str: ...
def find(self, sub: str, start: int = 0, end: int = 0) -> int: ...
def format(self, *args: Any, **kwargs: Any) -> str: ...
def format_map(self, map: Mapping[str, Any]) -> str: ...
def index(self, sub: str, start: int = 0, end: int = 0) -> int: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...
def isdecimal(self) -> bool: ...
def isdigit(self) -> bool: ...
def isidentifier(self) -> bool: ...
def islower(self) -> bool: ...
def isnumeric(self) -> bool: ...
def isprintable(self) -> bool: ...
def isspace(self) -> bool: ...
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
def join(self, iterable: Iterable[str]) -> str: ...
def ljust(self, width: int, fillchar: str = ' ') -> str: ...
def lower(self) -> str: ...
def lstrip(self, chars: str = None) -> str: ...
def partition(self, sep: str) -> Tuple[str, str, str]: ...
def replace(self, old: str, new: str, count: int = -1) -> str: ...
def rfind(self, sub: str, start: int = 0, end: int = 0) -> int: ...
def rindex(self, sub: str, start: int = 0, end: int = 0) -> int: ...
def rjust(self, width: int, fillchar: str = ' ') -> str: ...
def rpartition(self, sep: str) -> Tuple[str, str, str]: ...
def rsplit(self, sep: str = None, maxsplit: int = -1) -> List[str]: ...
def rstrip(self, chars: str = None) -> str: ...
def split(self, sep: str = None, maxsplit: int = -1) -> List[str]: ...
def splitlines(self, keepends: bool = False) -> List[str]: ...
def startswith(self, prefix: Union[str, Tuple[str, ...]], start: int = None,
end: int = None) -> bool: ...
def strip(self, chars: str = None) -> str: ...
def swapcase(self) -> str: ...
def title(self) -> str: ...
def translate(self, table: Dict[int, Any]) -> str: ...
def upper(self) -> str: ...
def zfill(self, width: int) -> str: ...
@staticmethod
@overload
def maketrans(self, x: Union[Dict[int, Any], Dict[str, Any]]) -> Dict[int, Any]: ...
@staticmethod
@overload
def maketrans(self, x: str, y: str, z: str = ...) -> Dict[int, Any]: ...
def __getitem__(self, i: Union[int, slice]) -> str: ...
def __add__(self, s: str) -> str: ...
def __mul__(self, n: int) -> str: ...
def __rmul__(self, n: int) -> str: ...
def __mod__(self, *args: Any) -> str: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: str) -> bool: ...
def __le__(self, x: str) -> bool: ...
def __gt__(self, x: str) -> bool: ...
def __ge__(self, x: str) -> bool: ...
def __len__(self) -> int: ...
def __contains__(self, s: object) -> bool: ...
def __iter__(self) -> Iterator[str]: ...
def __str__(self) -> str: return self
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
class bytes(ByteString):
@overload
def __init__(self, ints: Iterable[int]) -> None: ...
@overload
def __init__(self, string: str, encoding: str,
errors: str = 'strict') -> None: ...
@overload
def __init__(self, length: int) -> None: ...
@overload
def __init__(self) -> None: ...
def capitalize(self) -> bytes: ...
def center(self, width: int, fillchar: bytes = None) -> bytes: ...
def count(self, x: bytes) -> int: ...
def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ...
def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
def expandtabs(self, tabsize: int = 8) -> bytes: ...
def find(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def index(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...
def isdigit(self) -> bool: ...
def islower(self) -> bool: ...
def isspace(self) -> bool: ...
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
def join(self, iterable: Iterable[bytes]) -> bytes: ...
def ljust(self, width: int, fillchar: bytes = None) -> bytes: ...
def lower(self) -> bytes: ...
def lstrip(self, chars: bytes = None) -> bytes: ...
def partition(self, sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
def replace(self, old: bytes, new: bytes, count: int = -1) -> bytes: ...
def rfind(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rindex(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rjust(self, width: int, fillchar: bytes = None) -> bytes: ...
def rpartition(self, sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
def rsplit(self, sep: bytes = None, maxsplit: int = -1) -> List[bytes]: ...
def rstrip(self, chars: bytes = None) -> bytes: ...
def split(self, sep: bytes = None, maxsplit: int = -1) -> List[bytes]: ...
def splitlines(self, keepends: bool = False) -> List[bytes]: ...
def startswith(self, prefix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
def strip(self, chars: bytes = None) -> bytes: ...
def swapcase(self) -> bytes: ...
def title(self) -> bytes: ...
def translate(self, table: bytes) -> bytes: ...
def upper(self) -> bytes: ...
def zfill(self, width: int) -> bytes: ...
# TODO fromhex
# TODO maketrans
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[int]: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> int: ...
@overload
def __getitem__(self, s: slice) -> bytes: ...
def __add__(self, s: bytes) -> bytes: ...
def __mul__(self, n: int) -> bytes: ...
def __rmul__(self, n: int) -> bytes: ...
def __contains__(self, o: object) -> bool: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: bytes) -> bool: ...
def __le__(self, x: bytes) -> bool: ...
def __gt__(self, x: bytes) -> bool: ...
def __ge__(self, x: bytes) -> bool: ...
class bytearray(MutableSequence[int], ByteString):
@overload
def __init__(self, ints: Iterable[int]) -> None: ...
@overload
def __init__(self, string: str, encoding: str, errors: str = 'strict') -> None: ...
@overload
def __init__(self, length: int) -> None: ...
@overload
def __init__(self) -> None: ...
def capitalize(self) -> bytearray: ...
def center(self, width: int, fillchar: bytes = None) -> bytearray: ...
def count(self, x: bytes) -> int: ...
def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ...
def endswith(self, suffix: bytes) -> bool: ...
def expandtabs(self, tabsize: int = 8) -> bytearray: ...
def find(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def index(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def insert(self, index: int, object: int) -> None: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...
def isdigit(self) -> bool: ...
def islower(self) -> bool: ...
def isspace(self) -> bool: ...
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
def join(self, iterable: Iterable[bytes]) -> bytearray: ...
def ljust(self, width: int, fillchar: bytes = None) -> bytearray: ...
def lower(self) -> bytearray: ...
def lstrip(self, chars: bytes = None) -> bytearray: ...
def partition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def replace(self, old: bytes, new: bytes, count: int = -1) -> bytearray: ...
def rfind(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rindex(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rjust(self, width: int, fillchar: bytes = None) -> bytearray: ...
def rpartition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def rsplit(self, sep: bytes = None, maxsplit: int = -1) -> List[bytearray]: ...
def rstrip(self, chars: bytes = None) -> bytearray: ...
def split(self, sep: bytes = None, maxsplit: int = -1) -> List[bytearray]: ...
def splitlines(self, keepends: bool = False) -> List[bytearray]: ...
def startswith(self, prefix: bytes) -> bool: ...
def strip(self, chars: bytes = None) -> bytearray: ...
def swapcase(self) -> bytearray: ...
def title(self) -> bytearray: ...
def translate(self, table: bytes) -> bytearray: ...
def upper(self) -> bytearray: ...
def zfill(self, width: int) -> bytearray: ...
# TODO fromhex
# TODO maketrans
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[int]: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> int: ...
@overload
def __getitem__(self, s: slice) -> bytearray: ...
@overload
def __setitem__(self, i: int, x: int) -> None: ...
@overload
def __setitem__(self, s: slice, x: Sequence[int]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __add__(self, s: bytes) -> bytearray: ...
# TODO: Mypy complains about __add__ and __iadd__ having different signatures.
def __iadd__(self, s: Iterable[int]) -> bytearray: ... # type: ignore
def __mul__(self, n: int) -> bytearray: ...
def __rmul__(self, n: int) -> bytearray: ...
def __imul__(self, n: int) -> bytearray: ...
def __contains__(self, o: object) -> bool: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: bytes) -> bool: ...
def __le__(self, x: bytes) -> bool: ...
def __gt__(self, x: bytes) -> bool: ...
def __ge__(self, x: bytes) -> bool: ...
class memoryview():
# TODO arg can be any obj supporting the buffer protocol
def __init__(self, bytearray) -> None: ...
class bool(int, SupportsInt, SupportsFloat):
def __init__(self, o: object = False) -> None: ...
class slice:
start = 0
step = 0
stop = 0
def __init__(self, start: int, stop: int = 0, step: int = 0) -> None: ...
class tuple(Sequence[_T_co], Generic[_T_co]):
def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ...
def __len__(self) -> int: ...
def __contains__(self, x: object) -> bool: ...
@overload
def __getitem__(self, x: int) -> _T_co: ...
@overload
def __getitem__(self, x: slice) -> Tuple[_T_co, ...]: ...
def __iter__(self) -> Iterator[_T_co]: ...
def __lt__(self, x: Tuple[_T_co, ...]) -> bool: ...
def __le__(self, x: Tuple[_T_co, ...]) -> bool: ...
def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ...
def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ...
def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
def __mul__(self, n: int) -> Tuple[_T_co, ...]: ...
def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ...
def count(self, x: Any) -> int: ...
def index(self, x: Any) -> int: ...
class function:
# TODO not defined in builtins!
__name__ = ''
__qualname__ = ''
__module__ = ''
__code__ = ... # type: Any
class list(MutableSequence[_T], Reversible[_T], Generic[_T]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T]) -> None: ...
def clear(self) -> None: ...
def copy(self) -> List[_T]: ...
def append(self, object: _T) -> None: ...
def extend(self, iterable: Iterable[_T]) -> None: ...
def pop(self, index: int = -1) -> _T: ...
def index(self, object: _T, start: int = 0, stop: int = ...) -> int: ...
def count(self, object: _T) -> int: ...
def insert(self, index: int, object: _T) -> None: ...
def remove(self, object: _T) -> None: ...
def reverse(self) -> None: ...
def sort(self, *, key: Callable[[_T], Any] = None, reverse: bool = False) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __hash__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> _T: ...
@overload
def __getitem__(self, s: slice) -> List[_T]: ...
@overload
def __setitem__(self, i: int, o: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: Sequence[_T]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __add__(self, x: List[_T]) -> List[_T]: ...
def __iadd__(self, x: Iterable[_T]) -> List[_T]: ...
def __mul__(self, n: int) -> List[_T]: ...
def __rmul__(self, n: int) -> List[_T]: ...
def __imul__(self, n: int) -> List[_T]: ...
def __contains__(self, o: object) -> bool: ...
def __reversed__(self) -> Iterator[_T]: ...
def __gt__(self, x: List[_T]) -> bool: ...
def __ge__(self, x: List[_T]) -> bool: ...
def __lt__(self, x: List[_T]) -> bool: ...
def __le__(self, x: List[_T]) -> bool: ...
class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, map: Mapping[_KT, _VT]) -> None: ...
@overload
def __init__(self, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ... # TODO keyword args
def clear(self) -> None: ...
def copy(self) -> Dict[_KT, _VT]: ...
def get(self, k: _KT, default: _VT = None) -> _VT: ...
def pop(self, k: _KT, default: _VT = None) -> _VT: ...
def popitem(self) -> Tuple[_KT, _VT]: ...
def setdefault(self, k: _KT, default: _VT = None) -> _VT: ...
def update(self, m: Union[Mapping[_KT, _VT],
Iterable[Tuple[_KT, _VT]]]) -> None: ...
def keys(self) -> KeysView[_KT]: ...
def values(self) -> ValuesView[_VT]: ...
def items(self) -> ItemsView[_KT, _VT]: ...
@staticmethod
@overload
def fromkeys(seq: Sequence[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method
@staticmethod
@overload
def fromkeys(seq: Sequence[_T], value: _S) -> Dict[_T, _S]: ...
def __len__(self) -> int: ...
def __getitem__(self, k: _KT) -> _VT: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...
def __delitem__(self, v: _KT) -> None: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
class set(MutableSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T]=None) -> None: ...
def add(self, element: _T) -> None: ...
def clear(self) -> None: ...
def copy(self) -> set[_T]: ...
def difference(self, s: Iterable[Any]) -> set[_T]: ...
def difference_update(self, s: Iterable[Any]) -> None: ...
def discard(self, element: _T) -> None: ...
def intersection(self, s: Iterable[Any]) -> set[_T]: ...
def intersection_update(self, s: Iterable[Any]) -> None: ...
def isdisjoint(self, s: AbstractSet[Any]) -> bool: ...
def issubset(self, s: AbstractSet[Any]) -> bool: ...
def issuperset(self, s: AbstractSet[Any]) -> bool: ...
def pop(self) -> _T: ...
def remove(self, element: _T) -> None: ...
def symmetric_difference(self, s: Iterable[_T]) -> set[_T]: ...
def symmetric_difference_update(self, s: Iterable[_T]) -> None: ...
def union(self, s: Iterable[_T]) -> set[_T]: ...
def update(self, s: Iterable[_T]) -> None: ...
def __len__(self) -> int: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[Any]) -> set[_T]: ...
def __iand__(self, s: AbstractSet[Any]) -> set[_T]: ...
def __or__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __ior__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __sub__(self, s: AbstractSet[Any]) -> set[_T]: ...
def __isub__(self, s: AbstractSet[Any]) -> set[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __ixor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __le__(self, s: AbstractSet[Any]) -> bool: ...
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
# TODO more set operations
class frozenset(AbstractSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T]=None) -> None: ...
def copy(self) -> frozenset[_T]: ...
def difference(self, s: AbstractSet[Any]) -> frozenset[_T]: ...
def intersection(self, s: AbstractSet[Any]) -> frozenset[_T]: ...
def isdisjoint(self, s: AbstractSet[_T]) -> bool: ...
def issubset(self, s: AbstractSet[Any]) -> bool: ...
def issuperset(self, s: AbstractSet[Any]) -> bool: ...
def symmetric_difference(self, s: AbstractSet[_T]) -> frozenset[_T]: ...
def union(self, s: AbstractSet[_T]) -> frozenset[_T]: ...
def __len__(self) -> int: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[_T]) -> frozenset[_T]: ...
def __or__(self, s: AbstractSet[_S]) -> frozenset[Union[_T, _S]]: ...
def __sub__(self, s: AbstractSet[_T]) -> frozenset[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> frozenset[Union[_T, _S]]: ...
def __le__(self, s: AbstractSet[Any]) -> bool: ...
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
class enumerate(Iterator[Tuple[int, _T]], Generic[_T]):
def __init__(self, iterable: Iterable[_T], start: int = 0) -> None: ...
def __iter__(self) -> Iterator[Tuple[int, _T]]: ...
def __next__(self) -> Tuple[int, _T]: ...
# TODO __getattribute__
class range(Sequence[int], Reversible[int]):
@overload
def __init__(self, stop: int) -> None: ...
@overload
def __init__(self, start: int, stop: int, step: int = 1) -> None: ...
def count(self, value: int) -> int: ...
def index(self, value: int, start: int = 0, stop: int = None) -> int: ...
def __len__(self) -> int: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[int]: ...
@overload
def __getitem__(self, i: int) -> int: ...
@overload
def __getitem__(self, s: slice) -> range: ...
def __repr__(self) -> str: ...
def __reversed__(self) -> Iterator[int]: ...
class module:
# TODO not defined in builtins!
__name__ = ''
__file__ = ''
__dict__ = ... # type: Dict[str, Any]
True = ... # type: bool
False = ... # type: bool
__debug__ = False
NotImplemented = ... # type: Any
def abs(n: SupportsAbs[_T]) -> _T: ...
def all(i: Iterable) -> bool: ...
def any(i: Iterable) -> bool: ...
def ascii(o: object) -> str: ...
def bin(number: int) -> str: ...
def callable(o: object) -> bool: ...
def chr(code: int) -> str: ...
def compile(source: Any, filename: Union[str, bytes], mode: str, flags: int = 0,
dont_inherit: int = 0) -> Any: ...
def copyright() -> None: ...
def credits() -> None: ...
def delattr(o: Any, name: str) -> None: ...
def dir(o: object = None) -> List[str]: ...
_N = TypeVar('_N', int, float)
def divmod(a: _N, b: _N) -> Tuple[_N, _N]: ...
def eval(source: str, globals: Dict[str, Any] = None,
locals: Mapping[str, Any] = None) -> Any: ... # TODO code object as source
def exec(object: str, globals: Dict[str, Any] = None,
locals: Mapping[str, Any] = None) -> Any: ... # TODO code object as source
def exit(code: int = None) -> None: ...
def filter(function: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ...
def format(o: object, format_spec: str = '') -> str: ...
def getattr(o: Any, name: str, default: Any = None) -> Any: ...
def globals() -> Dict[str, Any]: ...
def hasattr(o: Any, name: str) -> bool: ...
def hash(o: object) -> int: ...
def help(*args: Any, **kwds: Any) -> None: ...
def hex(i: int) -> str: ... # TODO __index__
def id(o: object) -> int: ...
def input(prompt: str = None) -> str: ...
@overload
def iter(iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def iter(function: Callable[[], _T], sentinel: _T) -> Iterator[_T]: ...
def isinstance(o: object, t: Union[type, Tuple[type, ...]]) -> bool: ...
def issubclass(cls: type, classinfo: type) -> bool: ...
# TODO support this
#def issubclass(type cld, classinfo: Sequence[type]) -> bool: ...
def len(o: Union[Sized, tuple]) -> int: ...
def license() -> None: ...
def locals() -> Dict[str, Any]: ...
@overload
def map(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ...
@overload
def map(func: Callable[[_T1, _T2], _S], iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterator[_S]: ... # TODO more than two iterables
@overload
def max(iterable: Iterable[_T]) -> _T: ... # TODO keyword argument key
@overload
def max(arg1: _T, arg2: _T, *args: _T) -> _T: ...
# TODO memoryview
@overload
def min(iterable: Iterable[_T]) -> _T: ...
@overload
def min(arg1: _T, arg2: _T, *args: _T) -> _T: ...
@overload
def next(i: Iterator[_T]) -> _T: ...
@overload
def next(i: Iterator[_T], default: _T) -> _T: ...
def oct(i: int) -> str: ... # TODO __index__
def open(file: Union[str, bytes, int], mode: str = 'r', buffering: int = -1, encoding: str = None,
errors: str = None, newline: str = None, closefd: bool = True) -> IO[Any]: ...
def ord(c: Union[str, bytes, bytearray]) -> int: ...
def print(*values: Any, sep: str = ' ', end: str = '\n', file: IO[str] = None) -> None: ...
@overload
def pow(x: int, y: int) -> Any: ... # The return type can be int or float, depending on y
@overload
def pow(x: int, y: int, z: int) -> Any: ...
@overload
def pow(x: float, y: float) -> float: ...
@overload
def pow(x: float, y: float, z: float) -> float: ...
def quit(code: int = None) -> None: ...
@overload
def reversed(object: Reversible[_T]) -> Iterator[_T]: ...
@overload
def reversed(object: Sequence[_T]) -> Iterator[_T]: ...
def repr(o: object) -> str: ...
@overload
def round(number: float) -> int: ...
@overload
def round(number: float, ndigits: int) -> float: ... # Always return a float if given ndigits.
@overload
def round(number: SupportsRound[_T]) -> _T: ...
@overload
def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
def setattr(object: Any, name: str, value: Any) -> None: ...
def sorted(iterable: Iterable[_T], *, key: Callable[[_T], Any] = None,
reverse: bool = False) -> List[_T]: ...
def sum(iterable: Iterable[_T], start: _T = None) -> _T: ...
def vars(object: Any = None) -> Dict[str, Any]: ...
@overload
def zip(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2,
_T3, _T4]]: ... # TODO more than four iterables
def __import__(name: str, globals: Dict[str, Any] = {}, locals: Dict[str, Any] = {},
fromlist: List[str] = [], level: int = -1) -> Any: ...
# Ellipsis
class ellipsis:
# TODO not defined in builtins!
def __init__(self) -> None: ...
Ellipsis = ellipsis()
# Exceptions
class BaseException:
args = ... # type: Any
def __init__(self, *args: Any) -> None: ...
def with_traceback(self, tb: Any) -> BaseException: ...
class GeneratorExit(BaseException): ...
class KeyboardInterrupt(BaseException): ...
class SystemExit(BaseException):
code = 0
class Exception(BaseException): ...
class ArithmeticError(Exception): ...
class EnvironmentError(Exception):
errno = 0
strerror = ''
filename = '' # TODO can this be bytes?
class LookupError(Exception): ...
class RuntimeError(Exception): ...
class ValueError(Exception): ...
class AssertionError(Exception): ...
class AttributeError(Exception): ...
class BufferError(Exception): ...
class EOFError(Exception): ...
class FloatingPointError(ArithmeticError): ...
class IOError(EnvironmentError): ...
class ImportError(Exception): ...
class IndexError(LookupError): ...
class KeyError(LookupError): ...
class MemoryError(Exception): ...
class NameError(Exception): ...
class NotImplementedError(RuntimeError): ...
class OSError(EnvironmentError): ...
class BlockingIOError(OSError):
characters_written = 0
class ChildProcessError(OSError): ...
class ConnectionError(OSError): ...
class BrokenPipeError(ConnectionError): ...
class ConnectionAbortedError(ConnectionError): ...
class ConnectionRefusedError(ConnectionError): ...
class ConnectionResetError(ConnectionError): ...
class FileExistsError(OSError): ...
class FileNotFoundError(OSError): ...
class InterruptedError(OSError): ...
class IsADirectoryError(OSError): ...
class NotADirectoryError(OSError): ...
class PermissionError(OSError): ...
class ProcessLookupError(OSError): ...
class TimeoutError(OSError): ...
class WindowsError(OSError): ...
class OverflowError(ArithmeticError): ...
class ReferenceError(Exception): ...
class StopIteration(Exception): ...
class SyntaxError(Exception): ...
class IndentationError(SyntaxError): ...
class TabError(IndentationError): ...
class SystemError(Exception): ...
class TypeError(Exception): ...
class UnboundLocalError(NameError): ...
class UnicodeError(ValueError): ...
class UnicodeDecodeError(UnicodeError):
encoding = ... # type: str
object = ... # type: bytes
start = ... # type: int
end = ... # type: int
reason = ... # type: str
def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int,
__reason: str) -> None: ...
class UnicodeEncodeError(UnicodeError): ...
class UnicodeTranslateError(UnicodeError): ...
class ZeroDivisionError(ArithmeticError): ...
class Warning(Exception): ...
class UserWarning(Warning): ...
class DeprecationWarning(Warning): ...
class SyntaxWarning(Warning): ...
class RuntimeWarning(Warning): ...
class FutureWarning(Warning): ...
class PendingDeprecationWarning(Warning): ...
class ImportWarning(Warning): ...
class UnicodeWarning(Warning): ...
class BytesWarning(Warning): ...
class ResourceWarning(Warning): ...

15
stdlib/3/calendar.pyi Normal file
View File

@@ -0,0 +1,15 @@
# Stubs for calendar
# NOTE: These are incomplete!
from typing import overload, Tuple
# TODO actually, any number of items larger than 5 is fine
@overload
def timegm(t: Tuple[int, int, int, int, int, int]) -> int: ...
@overload
def timegm(t: Tuple[int, int, int, int, int, int, int]) -> int: ...
@overload
def timegm(t: Tuple[int, int, int, int, int, int, int, int]) -> int: ...
@overload
def timegm(t: Tuple[int, int, int, int, int, int, int, int, int]) -> int: ...

1
stdlib/3/cgi.pyi Normal file
View File

@@ -0,0 +1 @@
def escape(s: str) -> str: ...

31
stdlib/3/codecs.pyi Normal file
View File

@@ -0,0 +1,31 @@
from typing import Any, BinaryIO, Callable, IO
BOM_UTF8 = b''
class Codec: ...
class StreamWriter(Codec): ...
class CodecInfo(tuple):
def __init__(self, *args) -> None: ...
def register(search_function: Callable[[str], CodecInfo]) -> None:
...
def register_error(name: str, error_handler: Callable[[UnicodeError], Any]) -> None: ...
def lookup(encoding: str) -> CodecInfo:
...
# TODO This Callable is actually a StreamWriter constructor
def getwriter(encoding: str) -> Callable[[BinaryIO], StreamWriter]: ...
class IncrementalDecoder:
errors = ... # type: Any
def __init__(self, errors=''): ...
def decode(self, input, final=False): ...
def reset(self): ...
def getstate(self): ...
def setstate(self, state): ...
def open(filename: str, mode: str='rb', encoding: str=None, errors: str='strict', buffering: int=1) -> IO[Any]:
...

112
stdlib/3/collections.pyi Normal file
View File

@@ -0,0 +1,112 @@
# Stubs for collections
# Based on http://docs.python.org/3.2/library/collections.html
# TODO UserDict
# TODO UserList
# TODO UserString
# TODO more abstract base classes (interfaces in mypy)
from typing import (
TypeVar, Iterable, Generic, Iterator, Dict, overload,
Mapping, List, Tuple, Callable, Set, Sequence, Sized,
Optional, Union
)
import typing
_T = TypeVar('_T')
_KT = TypeVar('_KT')
_VT = TypeVar('_VT')
# namedtuple is special-cased in the type checker; the initializer is ignored.
namedtuple = object()
MutableMapping = typing.MutableMapping
class deque(Sized, Iterable[_T], Generic[_T]):
maxlen = 0 # type: Optional[int] # TODO readonly
def __init__(self, iterable: Iterable[_T] = None,
maxlen: int = None) -> None: ...
def append(self, x: _T) -> None: ...
def appendleft(self, x: _T) -> None: ...
def clear(self) -> None: ...
def count(self, x: _T) -> int: ...
def extend(self, iterable: Iterable[_T]) -> None: ...
def extendleft(self, iterable: Iterable[_T]) -> None: ...
def pop(self) -> _T: ...
def popleft(self) -> _T: ...
def remove(self, value: _T) -> None: ...
def reverse(self) -> None: ...
def rotate(self, n: int) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __hash__(self) -> int: ...
def __getitem__(self, i: int) -> _T: ...
def __setitem__(self, i: int, x: _T) -> None: ...
def __contains__(self, o: _T) -> bool: ...
# TODO __reversed__
class Counter(Dict[_T, int], Generic[_T]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, Mapping: Mapping[_T, int]) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T]) -> None: ...
# TODO keyword arguments
def elements(self) -> Iterator[_T]: ...
@overload
def most_common(self) -> List[_T]: ...
@overload
def most_common(self, n: int) -> List[_T]: ...
@overload
def subtract(self, Mapping: Mapping[_T, int]) -> None: ...
@overload
def subtract(self, iterable: Iterable[_T]) -> None: ...
# The Iterable[Tuple[...]] argument type is not actually desirable
# (the tuples will be added as keys, breaking type safety) but
# it's included so that the signature is compatible with
# Dict.update. Not sure if we should use '# type: ignore' instead
# and omit the type from the union.
def update(self, m: Union[Mapping[_T, int],
Iterable[Tuple[_T, int]],
Iterable[_T]]) -> None: ...
class OrderedDict(Dict[_KT, _VT], Generic[_KT, _VT]):
def popitem(self, last: bool = True) -> Tuple[_KT, _VT]: ...
def move_to_end(self, key: _KT, last: bool = True) -> None: ...
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
default_factory = ... # type: Callable[[], _VT]
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, map: Mapping[_KT, _VT]) -> None: ...
@overload
def __init__(self, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
@overload
def __init__(self, default_factory: Callable[[], _VT]) -> None: ...
@overload
def __init__(self, default_factory: Callable[[], _VT],
map: Mapping[_KT, _VT]) -> None: ...
@overload
def __init__(self, default_factory: Callable[[], _VT],
iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
# TODO __init__ keyword args
def __missing__(self, key: _KT) -> _VT: ...
# TODO __reversed__

8
stdlib/3/contextlib.pyi Normal file
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/3/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: ...

77
stdlib/3/csv.pyi Normal file
View File

@@ -0,0 +1,77 @@
# Stubs for csv (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
QUOTE_ALL = ... # type: int
QUOTE_MINIMAL = ... # type: int
QUOTE_NONE = ... # type: int
QUOTE_NONNUMERIC = ... # type: int
class Error(Exception): ...
def writer(csvfile, dialect=..., **fmtparams): ...
def reader(csvfile, dialect=..., **fmtparams): ...
def register_dialect(name, dialect=..., **fmtparams): ...
def unregister_dialect(name): ...
def get_dialect(name): ...
def list_dialects(): ...
def field_size_limit(new_limit=...): ...
class Dialect:
delimiter = ... # type: Any
quotechar = ... # type: Any
escapechar = ... # type: Any
doublequote = ... # type: Any
skipinitialspace = ... # type: Any
lineterminator = ... # type: Any
quoting = ... # type: Any
def __init__(self): ...
class excel(Dialect):
delimiter = ... # type: Any
quotechar = ... # type: Any
doublequote = ... # type: Any
skipinitialspace = ... # type: Any
lineterminator = ... # type: Any
quoting = ... # type: Any
class excel_tab(excel):
delimiter = ... # type: Any
class unix_dialect(Dialect):
delimiter = ... # type: Any
quotechar = ... # type: Any
doublequote = ... # type: Any
skipinitialspace = ... # type: Any
lineterminator = ... # type: Any
quoting = ... # type: Any
class DictReader:
restkey = ... # type: Any
restval = ... # type: Any
reader = ... # type: Any
dialect = ... # type: Any
line_num = ... # type: Any
fieldnames = ... # type: Any # Actually a property
def __init__(self, f, fieldnames=None, restkey=None, restval=None, dialect='',
*args, **kwds): ...
def __iter__(self): ...
def __next__(self): ...
class DictWriter:
fieldnames = ... # type: Any
restval = ... # type: Any
extrasaction = ... # type: Any
writer = ... # type: Any
def __init__(self, f, fieldnames, restval='', extrasaction='', dialect='', *args, **kwds): ...
def writeheader(self): ...
def writerow(self, rowdict): ...
def writerows(self, rowdicts): ...
class Sniffer:
preferred = ... # type: Any
def __init__(self): ...
def sniff(self, sample, delimiters=None): ...
def has_header(self, sample): ...

255
stdlib/3/decimal.pyi Normal file
View File

@@ -0,0 +1,255 @@
# Stubs for decimal (Python 3.4)
from typing import (
Any, Union, SupportsInt, SupportsFloat, SupportsAbs, SupportsRound, Sequence,
Tuple, NamedTuple, Dict
)
_Decimal = Union[Decimal, int]
BasicContext = ... # type: Context
DefaultContext = ... # type: Context
ExtendedContext = ... # type: Context
HAVE_THREADS = ... # type: bool
MAX_EMAX = ... # type: int
MAX_PREC = ... # type: int
MIN_EMIN = ... # type: int
MIN_ETINY = ... # type: int
ROUND_05UP = ... # type: str
ROUND_CEILING = ... # type: str
ROUND_DOWN = ... # type: str
ROUND_FLOOR = ... # type: str
ROUND_HALF_DOWN = ... # type: str
ROUND_HALF_EVEN = ... # type: str
ROUND_HALF_UP = ... # type: str
ROUND_UP = ... # type: str
def getcontext() -> Context: ...
def localcontext(ctx: Context = None) -> _ContextManager: ...
def setcontext(c: Context) -> None: ...
DecimalTuple = NamedTuple('DecimalTuple',
[('sign', int),
('digits', Sequence[int]), # TODO: Use Tuple[int, ...]
('exponent', int)])
class _ContextManager:
def __enter__(self) -> Context: ...
def __exit__(self, t, v, tb) -> None: ...
class Context:
Emax = ... # type: int
Emin = ... # type: int
capitals = ... # type: int
clamp = ... # type: int
prec = ... # type: int
rounding = ... # type: str
traps = ... # type: Dict[type, bool]
def __init__(self, prec: int = None, rounding: str = None, Emin: int = None, Emax: int = None,
capitals: int = None, clamp: int = None, flags=None, traps=None,
_ignored_flags=None) -> None: ...
def Etiny(self): ...
def Etop(self): ...
def abs(self, x: _Decimal) -> Decimal: ...
def add(self, x: _Decimal, y: _Decimal) -> Decimal: ...
def canonical(self, x): ...
def clear_flags(self): ...
def clear_traps(self): ...
def compare(self, x, y): ...
def compare_signal(self, x, y): ...
def compare_total(self, x, y): ...
def compare_total_mag(self, x, y): ...
def copy(self): ...
def copy_abs(self, x): ...
def copy_decimal(self, x): ...
def copy_negate(self, x): ...
def copy_sign(self, x, y): ...
def create_decimal(self, x): ...
def create_decimal_from_float(self, f): ...
def divide(self, x, y): ...
def divide_int(self, x, y): ...
def divmod(self, x, y): ...
def exp(self, x): ...
def fma(self, x, y, z): ...
def is_canonical(self, x): ...
def is_finite(self, x): ...
def is_infinite(self, x): ...
def is_nan(self, x): ...
def is_normal(self, x): ...
def is_qnan(self, x): ...
def is_signed(self, x): ...
def is_snan(self): ...
def is_subnormal(self, x): ...
def is_zero(self, x): ...
def ln(self, x): ...
def log10(self, x): ...
def logb(self, x): ...
def logical_and(self, x, y): ...
def logical_invert(self, x): ...
def logical_or(self, x, y): ...
def logical_xor(self, x, y): ...
def max(self, x, y): ...
def max_mag(self, x, y): ...
def min(self, x, y): ...
def min_mag(self, x, y): ...
def minus(self, x): ...
def multiply(self, x, y): ...
def next_minus(self, x): ...
def next_plus(self, x): ...
def next_toward(self, x): ...
def normalize(self, x): ...
def number_class(self, x): ...
def plus(self, x): ...
def power(self, x, y): ...
def quantize(self, x, y): ...
def radix(self): ...
def remainder(self, x, y): ...
def remainder_near(self, x, y): ...
def rotate(self, x, y): ...
def same_quantum(self, x, y): ...
def scaleb(self, x, y): ...
def shift(self, x, y): ...
def sqrt(self, x): ...
def subtract(self, x, y): ...
def to_eng_string(self, x): ...
def to_integral(self, x): ...
def to_integral_exact(self, x): ...
def to_integral_value(self, x): ...
def to_sci_string(self, x): ...
def __copy__(self) -> Context: ...
def __delattr__(self, name): ...
def __reduce__(self): ...
class ConversionSyntax(InvalidOperation): ...
class Decimal(SupportsInt, SupportsFloat, SupportsAbs[Decimal], SupportsRound[int]):
# TODO: SupportsCeil, SupportsFloor, SupportsTrunc?
def __init__(cls, value: Union[_Decimal, float, str,
Tuple[int, Sequence[int], int]] = '',
context: Context = None) -> None: ...
@property
def imag(self) -> Decimal: ...
@property
def real(self) -> Decimal: ...
def adjusted(self) -> int: ...
def as_tuple(self) -> DecimalTuple: ...
def canonical(self) -> Decimal: ...
def compare(self, other: _Decimal, context: Context = None) -> Decimal: ...
def compare_signal(self, other: _Decimal, context: Context = None) -> Decimal: ...
def compare_total(self, other: _Decimal, context: Context = None) -> Decimal: ...
def compare_total_mag(self, other: _Decimal, context: Context = None) -> Decimal: ...
def conjugate(self) -> Decimal: ...
def copy_abs(self) -> Decimal: ...
def copy_negate(self) -> Decimal: ...
def copy_sign(self, other: _Decimal, context: Context = None) -> Decimal: ...
def exp(self, context: Context = None) -> Decimal: ...
def fma(self, other: _Decimal, third: _Decimal, context: Context = None) -> Decimal: ...
@classmethod
def from_float(cls, f: float) -> Decimal: ...
def is_canonical(self) -> bool: ...
def is_finite(self) -> bool: ...
def is_infinite(self) -> bool: ...
def is_nan(self) -> bool: ...
def is_normal(self, context: Context = None) -> bool: ...
def is_qnan(self) -> bool: ...
def is_signed(self) -> bool: ...
def is_snan(self) -> bool: ...
def is_subnormal(self, context: Context = None) -> bool: ...
def is_zero(self) -> bool: ...
def ln(self, context: Context = None) -> Decimal: ...
def log10(self, context: Context = None) -> Decimal: ...
def logb(self, context: Context = None) -> Decimal: ...
def logical_and(self, other: _Decimal, context: Context = None) -> Decimal: ...
def logical_invert(self, context: Context = None) -> Decimal: ...
def logical_or(self, other: _Decimal, context: Context = None) -> Decimal: ...
def logical_xor(self, other: _Decimal, context: Context = None) -> Decimal: ...
def max(self, other: _Decimal, context: Context = None) -> Decimal: ...
def max_mag(self, other: _Decimal, context: Context = None) -> Decimal: ...
def min(self, other: _Decimal, context: Context = None) -> Decimal: ...
def min_mag(self, other: _Decimal, context: Context = None) -> Decimal: ...
def next_minus(self, context: Context = None) -> Decimal: ...
def next_plus(self, context: Context = None) -> Decimal: ...
def next_toward(self, other: _Decimal, context: Context = None) -> Decimal: ...
def normalize(self, context: Context = None) -> Decimal: ...
def number_class(self, context: Context = None) -> str: ...
def quantize(self, exp: _Decimal, rounding: str = None,
context: Context = None) -> Decimal: ...
def radix(self) -> Decimal: ...
def remainder_near(self, other: _Decimal, context: Context = None) -> Decimal: ...
def rotate(self, other: _Decimal, context: Context = None) -> Decimal: ...
def same_quantum(self, other: _Decimal, context: Context = None) -> bool: ...
def scaleb(self, other: _Decimal, context: Context = None) -> Decimal: ...
def shift(self, other: _Decimal, context: Context = None) -> Decimal: ...
def sqrt(self, context: Context = None) -> Decimal: ...
def to_eng_string(self, context: Context = None) -> str: ...
def to_integral(self, rounding: str = None, context: Context = None) -> Decimal: ...
def to_integral_exact(self, rounding: str = None, context: Context = None) -> Decimal: ...
def to_integral_value(self, rounding: str = None, context: Context = None) -> Decimal: ...
def __abs__(self) -> Decimal: ...
def __add__(self, other: _Decimal) -> Decimal: ...
def __bool__(self) -> bool: ...
def __ceil__(self) -> int: ...
def __complex__(self) -> complex: ...
def __copy__(self) -> Decimal: ...
def __deepcopy__(self) -> Decimal: ...
def __divmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ...
def __eq__(self, other: object) -> bool: ...
def __float__(self) -> float: ...
def __floor__(self) -> int: ...
def __floordiv__(self, other: _Decimal) -> Decimal: ...
def __format__(self, specifier, context=None, _localeconv=None) -> str: ...
def __ge__(self, other: _Decimal) -> bool: ...
def __gt__(self, other: _Decimal) -> bool: ...
def __hash__(self) -> int: ...
def __int__(self) -> int: ...
def __le__(self, other: _Decimal) -> bool: ...
def __lt__(self, other: _Decimal) -> bool: ...
def __mod__(self, other: _Decimal) -> Decimal: ...
def __mul__(self, other: _Decimal) -> Decimal: ...
def __ne__(self, other: object) -> bool: ...
def __neg__(self) -> Decimal: ...
def __pos__(self) -> Decimal: ...
def __pow__(self, other: _Decimal) -> Decimal: ...
def __radd__(self, other: int) -> Decimal: ...
def __rdivmod__(self, other: int) -> Tuple[Decimal, Decimal]: ...
def __reduce__(self): ...
def __rfloordiv__(self, other: int) -> Decimal: ...
def __rmod__(self, other: int) -> Decimal: ...
def __rmul__(self, other: int) -> Decimal: ...
def __round__(self, n=None) -> int: ...
def __rpow__(self, other: int) -> Decimal: ...
def __rsub__(self, other: int) -> Decimal: ...
def __rtruediv__(self, other: int) -> Decimal: ...
def __sizeof__(self) -> int: ...
def __sub__(self, other: _Decimal) -> Decimal: ...
def __truediv__(self, other: _Decimal) -> Decimal: ...
def __trunc__(self) -> int: ...
class DecimalException(ArithmeticError): ...
class Clamped(DecimalException): ...
class DivisionByZero(DecimalException, ZeroDivisionError): ...
class DivisionImpossible(InvalidOperation): ...
class DivisionUndefined(InvalidOperation, ZeroDivisionError): ...
class FloatOperation(DecimalException, TypeError): ...
class Inexact(DecimalException): ...
class InvalidContext(InvalidOperation): ...
class InvalidOperation(DecimalException): ...
class Overflow(Inexact, Rounded): ...
class Rounded(DecimalException): ...
class Subnormal(DecimalException): ...
class Underflow(Inexact, Rounded, Subnormal): ...

61
stdlib/3/difflib.pyi Normal file
View File

@@ -0,0 +1,61 @@
# Stubs for difflib
# Based on https://docs.python.org/3.2/library/difflib.html
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] = ..., b: Sequence[_T] = ...,
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

View File

@@ -0,0 +1,4 @@
import typing
class DistutilsError(Exception): ...
class DistutilsExecError(DistutilsError): ...

View File

@@ -0,0 +1,6 @@
from typing import List
# In Python, arguments have integer default values
def spawn(cmd: List[str], search_path: bool = True, verbose: bool = False,
dry_run: bool = False) -> None: ...
def find_executable(executable: str, path: str = None) -> str: ...

9
stdlib/3/doctest.pyi Normal file
View File

@@ -0,0 +1,9 @@
# Stubs for doctest
# NOTE: These are incomplete!
from typing import Any, Tuple
# TODO arguments missing
def testmod(module: Any = None, *, name: str = None, globs: Any = None,
verbose: bool = None) -> Tuple[int, int]: ...

View File

@@ -0,0 +1 @@
...

View File

@@ -0,0 +1,3 @@
from typing import Any
html_parts = ... # type: Any

View File

@@ -0,0 +1,8 @@
from typing import Any, List
class reference:
def __init__(self,
rawsource: str = '',
text: str = '',
*children: List[Any],
**attributes) -> None: ...

View File

@@ -0,0 +1 @@
...

View File

@@ -0,0 +1 @@
...

View File

@@ -0,0 +1,10 @@
import docutils.nodes
import docutils.parsers.rst.states
from typing import Callable, Any, List, Dict, Tuple
def register_local_role(name: str,
role_fn: Callable[[str, str, str, int, docutils.parsers.rst.states.Inliner, Dict, List],
Tuple[List[docutils.nodes.reference], List[docutils.nodes.reference]]]
) -> None:
...

View File

@@ -0,0 +1,5 @@
import typing
class Inliner:
def __init__(self) -> None:
...

View File

@@ -0,0 +1,23 @@
# Stubs for email (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
def message_from_string(s, *args, **kws): ...
def message_from_bytes(s, *args, **kws): ...
def message_from_file(fp, *args, **kws): ...
def message_from_binary_file(fp, *args, **kws): ...
# Names in __all__ with no definition:
# base64mime
# charset
# encoders
# errors
# feedparser
# generator
# header
# iterators
# message
# mime
# parser
# quoprimime
# utils

View File

@@ -0,0 +1,397 @@
# Stubs for email._header_value_parser (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
WSP = ... # type: Any
CFWS_LEADER = ... # type: Any
SPECIALS = ... # type: Any
ATOM_ENDS = ... # type: Any
DOT_ATOM_ENDS = ... # type: Any
PHRASE_ENDS = ... # type: Any
TSPECIALS = ... # type: Any
TOKEN_ENDS = ... # type: Any
ASPECIALS = ... # type: Any
ATTRIBUTE_ENDS = ... # type: Any
EXTENDED_ATTRIBUTE_ENDS = ... # type: Any
def quote_string(value): ...
class _Folded:
maxlen = ... # type: Any
policy = ... # type: Any
lastlen = ... # type: Any
stickyspace = ... # type: Any
firstline = ... # type: Any
done = ... # type: Any
current = ... # type: Any
def __init__(self, maxlen, policy): ...
def newline(self): ...
def finalize(self): ...
def append(self, stoken): ...
def append_if_fits(self, token, stoken=None): ...
class TokenList(list):
token_type = ... # type: Any
defects = ... # type: Any
def __init__(self, *args, **kw): ...
@property
def value(self): ...
@property
def all_defects(self): ...
@property
def parts(self): ...
def startswith_fws(self): ...
def pop_leading_fws(self): ...
def pop_trailing_ws(self): ...
@property
def has_fws(self): ...
def has_leading_comment(self): ...
@property
def comments(self): ...
def fold(self, policy): ...
def as_encoded_word(self, charset): ...
def cte_encode(self, charset, policy): ...
def pprint(self, indent=''): ...
def ppstr(self, indent=''): ...
class WhiteSpaceTokenList(TokenList):
@property
def value(self): ...
@property
def comments(self): ...
class UnstructuredTokenList(TokenList):
token_type = ... # type: Any
def cte_encode(self, charset, policy): ...
class Phrase(TokenList):
token_type = ... # type: Any
def cte_encode(self, charset, policy): ...
class Word(TokenList):
token_type = ... # type: Any
class CFWSList(WhiteSpaceTokenList):
token_type = ... # type: Any
def has_leading_comment(self): ...
class Atom(TokenList):
token_type = ... # type: Any
class Token(TokenList):
token_type = ... # type: Any
class EncodedWord(TokenList):
token_type = ... # type: Any
cte = ... # type: Any
charset = ... # type: Any
lang = ... # type: Any
@property
def encoded(self): ...
class QuotedString(TokenList):
token_type = ... # type: Any
@property
def content(self): ...
@property
def quoted_value(self): ...
@property
def stripped_value(self): ...
class BareQuotedString(QuotedString):
token_type = ... # type: Any
@property
def value(self): ...
class Comment(WhiteSpaceTokenList):
token_type = ... # type: Any
def quote(self, value): ...
@property
def content(self): ...
@property
def comments(self): ...
class AddressList(TokenList):
token_type = ... # type: Any
@property
def addresses(self): ...
@property
def mailboxes(self): ...
@property
def all_mailboxes(self): ...
class Address(TokenList):
token_type = ... # type: Any
@property
def display_name(self): ...
@property
def mailboxes(self): ...
@property
def all_mailboxes(self): ...
class MailboxList(TokenList):
token_type = ... # type: Any
@property
def mailboxes(self): ...
@property
def all_mailboxes(self): ...
class GroupList(TokenList):
token_type = ... # type: Any
@property
def mailboxes(self): ...
@property
def all_mailboxes(self): ...
class Group(TokenList):
token_type = ... # type: Any
@property
def mailboxes(self): ...
@property
def all_mailboxes(self): ...
@property
def display_name(self): ...
class NameAddr(TokenList):
token_type = ... # type: Any
@property
def display_name(self): ...
@property
def local_part(self): ...
@property
def domain(self): ...
@property
def route(self): ...
@property
def addr_spec(self): ...
class AngleAddr(TokenList):
token_type = ... # type: Any
@property
def local_part(self): ...
@property
def domain(self): ...
@property
def route(self): ...
@property
def addr_spec(self): ...
class ObsRoute(TokenList):
token_type = ... # type: Any
@property
def domains(self): ...
class Mailbox(TokenList):
token_type = ... # type: Any
@property
def display_name(self): ...
@property
def local_part(self): ...
@property
def domain(self): ...
@property
def route(self): ...
@property
def addr_spec(self): ...
class InvalidMailbox(TokenList):
token_type = ... # type: Any
@property
def display_name(self): ...
local_part = ... # type: Any
class Domain(TokenList):
token_type = ... # type: Any
@property
def domain(self): ...
class DotAtom(TokenList):
token_type = ... # type: Any
class DotAtomText(TokenList):
token_type = ... # type: Any
class AddrSpec(TokenList):
token_type = ... # type: Any
@property
def local_part(self): ...
@property
def domain(self): ...
@property
def value(self): ...
@property
def addr_spec(self): ...
class ObsLocalPart(TokenList):
token_type = ... # type: Any
class DisplayName(Phrase):
token_type = ... # type: Any
@property
def display_name(self): ...
@property
def value(self): ...
class LocalPart(TokenList):
token_type = ... # type: Any
@property
def value(self): ...
@property
def local_part(self): ...
class DomainLiteral(TokenList):
token_type = ... # type: Any
@property
def domain(self): ...
@property
def ip(self): ...
class MIMEVersion(TokenList):
token_type = ... # type: Any
major = ... # type: Any
minor = ... # type: Any
class Parameter(TokenList):
token_type = ... # type: Any
sectioned = ... # type: Any
extended = ... # type: Any
charset = ... # type: Any
@property
def section_number(self): ...
@property
def param_value(self): ...
class InvalidParameter(Parameter):
token_type = ... # type: Any
class Attribute(TokenList):
token_type = ... # type: Any
@property
def stripped_value(self): ...
class Section(TokenList):
token_type = ... # type: Any
number = ... # type: Any
class Value(TokenList):
token_type = ... # type: Any
@property
def stripped_value(self): ...
class MimeParameters(TokenList):
token_type = ... # type: Any
@property
def params(self): ...
class ParameterizedHeaderValue(TokenList):
@property
def params(self): ...
@property
def parts(self): ...
class ContentType(ParameterizedHeaderValue):
token_type = ... # type: Any
maintype = ... # type: Any
subtype = ... # type: Any
class ContentDisposition(ParameterizedHeaderValue):
token_type = ... # type: Any
content_disposition = ... # type: Any
class ContentTransferEncoding(TokenList):
token_type = ... # type: Any
cte = ... # type: Any
class HeaderLabel(TokenList):
token_type = ... # type: Any
class Header(TokenList):
token_type = ... # type: Any
class Terminal(str):
token_type = ... # type: Any
defects = ... # type: Any
def __new__(cls, value, token_type): ...
@property
def all_defects(self): ...
def cte_encode(self, charset, policy): ...
def pop_trailing_ws(self): ...
def pop_leading_fws(self): ...
@property
def comments(self): ...
def has_leading_comment(self): ...
def __getnewargs__(self): ...
class WhiteSpaceTerminal(Terminal):
@property
def value(self): ...
def startswith_fws(self): ...
has_fws = ... # type: Any
class ValueTerminal(Terminal):
@property
def value(self): ...
def startswith_fws(self): ...
has_fws = ... # type: Any
def as_encoded_word(self, charset): ...
class EWWhiteSpaceTerminal(WhiteSpaceTerminal):
@property
def value(self): ...
@property
def encoded(self): ...
has_fws = ... # type: Any
DOT = ... # type: Any
ListSeparator = ... # type: Any
RouteComponentMarker = ... # type: Any
def get_fws(value): ...
def get_encoded_word(value): ...
def get_unstructured(value): ...
def get_qp_ctext(value): ...
def get_qcontent(value): ...
def get_atext(value): ...
def get_bare_quoted_string(value): ...
def get_comment(value): ...
def get_cfws(value): ...
def get_quoted_string(value): ...
def get_atom(value): ...
def get_dot_atom_text(value): ...
def get_dot_atom(value): ...
def get_word(value): ...
def get_phrase(value): ...
def get_local_part(value): ...
def get_obs_local_part(value): ...
def get_dtext(value): ...
def get_domain_literal(value): ...
def get_domain(value): ...
def get_addr_spec(value): ...
def get_obs_route(value): ...
def get_angle_addr(value): ...
def get_display_name(value): ...
def get_name_addr(value): ...
def get_mailbox(value): ...
def get_invalid_mailbox(value, endchars): ...
def get_mailbox_list(value): ...
def get_group_list(value): ...
def get_group(value): ...
def get_address(value): ...
def get_address_list(value): ...
def parse_mime_version(value): ...
def get_invalid_parameter(value): ...
def get_ttext(value): ...
def get_token(value): ...
def get_attrtext(value): ...
def get_attribute(value): ...
def get_extended_attrtext(value): ...
def get_extended_attribute(value): ...
def get_section(value): ...
def get_value(value): ...
def get_parameter(value): ...
def parse_mime_parameters(value): ...
def parse_content_type_header(value): ...
def parse_content_disposition_header(value): ...
def parse_content_transfer_encoding_header(value): ...

View File

@@ -0,0 +1,44 @@
# Stubs for email._parseaddr (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
def parsedate_tz(data): ...
def parsedate(data): ...
def mktime_tz(data): ...
def quote(str): ...
class AddrlistClass:
specials = ... # type: Any
pos = ... # type: Any
LWS = ... # type: Any
CR = ... # type: Any
FWS = ... # type: Any
atomends = ... # type: Any
phraseends = ... # type: Any
field = ... # type: Any
commentlist = ... # type: Any
def __init__(self, field): ...
def gotonext(self): ...
def getaddrlist(self): ...
def getaddress(self): ...
def getrouteaddr(self): ...
def getaddrspec(self): ...
def getdomain(self): ...
def getdelimited(self, beginchar, endchars, allowcomments=True): ...
def getquote(self): ...
def getcomment(self): ...
def getdomainliteral(self): ...
def getatom(self, atomends=None): ...
def getphraselist(self): ...
class AddressList(AddrlistClass):
addresslist = ... # type: Any
def __init__(self, field): ...
def __len__(self): ...
def __add__(self, other): ...
def __iadd__(self, other): ...
def __sub__(self, other): ...
def __isub__(self, other): ...
def __getitem__(self, index): ...

View File

@@ -0,0 +1,34 @@
# Stubs for email._policybase (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class _PolicyBase:
def __init__(self, **kw): ...
def clone(self, **kw): ...
def __setattr__(self, name, value): ...
def __add__(self, other): ...
class Policy(_PolicyBase):
raise_on_defect = ... # type: Any
linesep = ... # type: Any
cte_type = ... # type: Any
max_line_length = ... # type: Any
def handle_defect(self, obj, defect): ...
def register_defect(self, obj, defect): ...
def header_max_count(self, name): ...
def header_source_parse(self, sourcelines): ...
def header_store_parse(self, name, value): ...
def header_fetch_parse(self, name, value): ...
def fold(self, name, value): ...
def fold_binary(self, name, value): ...
class Compat32(Policy):
def header_source_parse(self, sourcelines): ...
def header_store_parse(self, name, value): ...
def header_fetch_parse(self, name, value): ...
def fold(self, name, value): ...
def fold_binary(self, name, value): ...
compat32 = ... # type: Any

View File

@@ -0,0 +1,13 @@
# Stubs for email.base64mime (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
def header_length(bytearray): ...
def header_encode(header_bytes, charset=''): ...
def body_encode(s, maxlinelen=76, eol=...): ...
def decode(string): ...
body_decode = ... # type: Any
decodestring = ... # type: Any

View File

@@ -0,0 +1,25 @@
# Stubs for email.charset (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
def add_charset(charset, header_enc=None, body_enc=None, output_charset=None): ...
def add_alias(alias, canonical): ...
def add_codec(charset, codecname): ...
class Charset:
input_charset = ... # type: Any
header_encoding = ... # type: Any
body_encoding = ... # type: Any
output_charset = ... # type: Any
input_codec = ... # type: Any
output_codec = ... # type: Any
def __init__(self, input_charset=...): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def get_body_encoding(self): ...
def get_output_charset(self): ...
def header_encode(self, string): ...
def header_encode_lines(self, string, maxlengths): ...
def body_encode(self, string): ...

View File

@@ -0,0 +1,27 @@
# Stubs for email.contentmanager (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class ContentManager:
get_handlers = ... # type: Any
set_handlers = ... # type: Any
def __init__(self): ...
def add_get_handler(self, key, handler): ...
def get_content(self, msg, *args, **kw): ...
def add_set_handler(self, typekey, handler): ...
def set_content(self, msg, obj, *args, **kw): ...
raw_data_manager = ... # type: Any
def get_text_content(msg, errors=''): ...
def get_non_text_content(msg): ...
def get_message_content(msg): ...
def get_and_fixup_unknown_message_content(msg): ...
def set_text_content(msg, string, subtype='', charset='', cte=None, disposition=None,
filename=None, cid=None, params=None, headers=None): ...
def set_message_content(msg, message, subtype='', cte=None, disposition=None, filename=None,
cid=None, params=None, headers=None): ...
def set_bytes_content(msg, data, maintype, subtype, cte='', disposition=None, filename=None,
cid=None, params=None, headers=None): ...

View File

@@ -0,0 +1,8 @@
# Stubs for email.encoders (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
def encode_base64(msg): ...
def encode_quopri(msg): ...
def encode_7or8bit(msg): ...
def encode_noop(msg): ...

44
stdlib/3/email/errors.pyi Normal file
View File

@@ -0,0 +1,44 @@
# Stubs for email.errors (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class MessageError(Exception): ...
class MessageParseError(MessageError): ...
class HeaderParseError(MessageParseError): ...
class BoundaryError(MessageParseError): ...
class MultipartConversionError(MessageError, TypeError): ...
class CharsetError(MessageError): ...
class MessageDefect(ValueError):
line = ... # type: Any
def __init__(self, line=None): ...
class NoBoundaryInMultipartDefect(MessageDefect): ...
class StartBoundaryNotFoundDefect(MessageDefect): ...
class CloseBoundaryNotFoundDefect(MessageDefect): ...
class FirstHeaderLineIsContinuationDefect(MessageDefect): ...
class MisplacedEnvelopeHeaderDefect(MessageDefect): ...
class MissingHeaderBodySeparatorDefect(MessageDefect): ...
MalformedHeaderDefect = ... # type: Any
class MultipartInvariantViolationDefect(MessageDefect): ...
class InvalidMultipartContentTransferEncodingDefect(MessageDefect): ...
class UndecodableBytesDefect(MessageDefect): ...
class InvalidBase64PaddingDefect(MessageDefect): ...
class InvalidBase64CharactersDefect(MessageDefect): ...
class HeaderDefect(MessageDefect):
def __init__(self, *args, **kw): ...
class InvalidHeaderDefect(HeaderDefect): ...
class HeaderMissingRequiredValue(HeaderDefect): ...
class NonPrintableDefect(HeaderDefect):
non_printables = ... # type: Any
def __init__(self, non_printables): ...
class ObsoleteHeaderDefect(HeaderDefect): ...
class NonASCIILocalPartDefect(HeaderDefect): ...

View File

@@ -0,0 +1,26 @@
# Stubs for email.feedparser (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class BufferedSubFile:
def __init__(self): ...
def push_eof_matcher(self, pred): ...
def pop_eof_matcher(self): ...
def close(self): ...
def readline(self): ...
def unreadline(self, line): ...
def push(self, data): ...
def pushlines(self, lines): ...
def __iter__(self): ...
def __next__(self): ...
class FeedParser:
policy = ... # type: Any
def __init__(self, _factory=None, *, policy=...): ...
def feed(self, data): ...
def close(self): ...
class BytesFeedParser(FeedParser):
def feed(self, data): ...

View File

@@ -0,0 +1,19 @@
# Stubs for email.generator (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class Generator:
maxheaderlen = ... # type: Any
policy = ... # type: Any
def __init__(self, outfp, mangle_from_=True, maxheaderlen=None, *, policy=None): ...
def write(self, s): ...
def flatten(self, msg, unixfrom=False, linesep=None): ...
def clone(self, fp): ...
class BytesGenerator(Generator):
def write(self, s): ...
class DecodedGenerator(Generator):
def __init__(self, outfp, mangle_from_=True, maxheaderlen=78, fmt=None): ...

29
stdlib/3/email/header.pyi Normal file
View File

@@ -0,0 +1,29 @@
# Stubs for email.header (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
def decode_header(header): ...
def make_header(decoded_seq, maxlinelen=None, header_name=None, continuation_ws=''): ...
class Header:
def __init__(self, s=None, charset=None, maxlinelen=None, header_name=None,
continuation_ws='', errors=''): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def append(self, s, charset=None, errors=''): ...
def encode(self, splitchars='', maxlinelen=None, linesep=''): ...
class _ValueFormatter:
def __init__(self, headerlen, maxlen, continuation_ws, splitchars): ...
def newline(self): ...
def add_transition(self): ...
def feed(self, fws, string, charset): ...
class _Accumulator(list):
def __init__(self, initial_size=0): ...
def push(self, fws, string): ...
def pop_from(self, i=0): ...
def __len__(self): ...
def reset(self, startval=None): ...
def is_onlyws(self): ...
def part_count(self): ...

View File

@@ -0,0 +1,133 @@
# Stubs for email.headerregistry (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class Address:
def __init__(self, display_name='', username='', domain='', addr_spec=None): ...
@property
def display_name(self): ...
@property
def username(self): ...
@property
def domain(self): ...
@property
def addr_spec(self): ...
def __eq__(self, other): ...
class Group:
def __init__(self, display_name=None, addresses=None): ...
@property
def display_name(self): ...
@property
def addresses(self): ...
def __eq__(self, other): ...
class BaseHeader(str):
def __new__(cls, name, value): ...
def init(self, name, parse_tree, defects): ...
@property
def name(self): ...
@property
def defects(self): ...
def __reduce__(self): ...
def fold(self, policy): ...
class UnstructuredHeader:
max_count = ... # type: Any
value_parser = ... # type: Any
@classmethod
def parse(cls, value, kwds): ...
class UniqueUnstructuredHeader(UnstructuredHeader):
max_count = ... # type: Any
class DateHeader:
max_count = ... # type: Any
value_parser = ... # type: Any
@classmethod
def parse(cls, value, kwds): ...
def init(self, *args, **kw): ...
@property
def datetime(self): ...
class UniqueDateHeader(DateHeader):
max_count = ... # type: Any
class AddressHeader:
max_count = ... # type: Any
@staticmethod
def value_parser(value): ...
@classmethod
def parse(cls, value, kwds): ...
def init(self, *args, **kw): ...
@property
def groups(self): ...
@property
def addresses(self): ...
class UniqueAddressHeader(AddressHeader):
max_count = ... # type: Any
class SingleAddressHeader(AddressHeader):
@property
def address(self): ...
class UniqueSingleAddressHeader(SingleAddressHeader):
max_count = ... # type: Any
class MIMEVersionHeader:
max_count = ... # type: Any
value_parser = ... # type: Any
@classmethod
def parse(cls, value, kwds): ...
def init(self, *args, **kw): ...
@property
def major(self): ...
@property
def minor(self): ...
@property
def version(self): ...
class ParameterizedMIMEHeader:
max_count = ... # type: Any
@classmethod
def parse(cls, value, kwds): ...
def init(self, *args, **kw): ...
@property
def params(self): ...
class ContentTypeHeader(ParameterizedMIMEHeader):
value_parser = ... # type: Any
def init(self, *args, **kw): ...
@property
def maintype(self): ...
@property
def subtype(self): ...
@property
def content_type(self): ...
class ContentDispositionHeader(ParameterizedMIMEHeader):
value_parser = ... # type: Any
def init(self, *args, **kw): ...
@property
def content_disposition(self): ...
class ContentTransferEncodingHeader:
max_count = ... # type: Any
value_parser = ... # type: Any
@classmethod
def parse(cls, value, kwds): ...
def init(self, *args, **kw): ...
@property
def cte(self): ...
class HeaderRegistry:
registry = ... # type: Any
base_class = ... # type: Any
default_class = ... # type: Any
def __init__(self, base_class=..., default_class=..., use_default_map=True): ...
def map_to_type(self, name, cls): ...
def __getitem__(self, name): ...
def __call__(self, name, value): ...

View File

@@ -0,0 +1,7 @@
# Stubs for email.iterators (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
def walk(self): ...
def body_line_iterator(msg, decode=False): ...
def typed_subpart_iterator(msg, maintype='', subtype=None): ...

View File

@@ -0,0 +1,74 @@
# Stubs for email.message (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class Message:
policy = ... # type: Any
preamble = ... # type: Any
defects = ... # type: Any
def __init__(self, policy=...): ...
def as_string(self, unixfrom=False, maxheaderlen=0, policy=None): ...
def __bytes__(self): ...
def as_bytes(self, unixfrom=False, policy=None): ...
def is_multipart(self): ...
def set_unixfrom(self, unixfrom): ...
def get_unixfrom(self): ...
def attach(self, payload): ...
def get_payload(self, i=None, decode=False): ...
def set_payload(self, payload, charset=None): ...
def set_charset(self, charset): ...
def get_charset(self): ...
def __len__(self): ...
def __getitem__(self, name): ...
def __setitem__(self, name, val): ...
def __delitem__(self, name): ...
def __contains__(self, name): ...
def __iter__(self): ...
def keys(self): ...
def values(self): ...
def items(self): ...
def get(self, name, failobj=None): ...
def set_raw(self, name, value): ...
def raw_items(self): ...
def get_all(self, name, failobj=None): ...
def add_header(self, _name, _value, **_params): ...
def replace_header(self, _name, _value): ...
def get_content_type(self): ...
def get_content_maintype(self): ...
def get_content_subtype(self): ...
def get_default_type(self): ...
def set_default_type(self, ctype): ...
def get_params(self, failobj=None, header='', unquote=True): ...
def get_param(self, param, failobj=None, header='', unquote=True): ...
def set_param(self, param, value, header='', requote=True, charset=None, language='',
replace=False): ...
def del_param(self, param, header='', requote=True): ...
def set_type(self, type, header='', requote=True): ...
def get_filename(self, failobj=None): ...
def get_boundary(self, failobj=None): ...
def set_boundary(self, boundary): ...
def get_content_charset(self, failobj=None): ...
def get_charsets(self, failobj=None): ...
class MIMEPart(Message):
def __init__(self, policy=None): ...
@property
def is_attachment(self): ...
def get_body(self, preferencelist=...): ...
def iter_attachments(self): ...
def iter_parts(self): ...
def get_content(self, *args, *, content_manager=None, **kw): ...
def set_content(self, *args, *, content_manager=None, **kw): ...
def make_related(self, boundary=None): ...
def make_alternative(self, boundary=None): ...
def make_mixed(self, boundary=None): ...
def add_related(self, *args, **kw): ...
def add_alternative(self, *args, **kw): ...
def add_attachment(self, *args, **kw): ...
def clear(self): ...
def clear_content(self): ...
class EmailMessage(MIMEPart):
def set_content(self, *args, **kw): ...

View File

@@ -0,0 +1,4 @@
# Stubs for email.mime (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

View File

@@ -0,0 +1,8 @@
# Stubs for email.mime.application (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from email.mime.nonmultipart import MIMENonMultipart
class MIMEApplication(MIMENonMultipart):
def __init__(self, _data, _subtype='', _encoder=..., **_params): ...

View File

@@ -0,0 +1,8 @@
# Stubs for email.mime.audio (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from email.mime.nonmultipart import MIMENonMultipart
class MIMEAudio(MIMENonMultipart):
def __init__(self, _audiodata, _subtype=None, _encoder=..., **_params): ...

View File

@@ -0,0 +1,8 @@
# Stubs for email.mime.base (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from email import message
class MIMEBase(message.Message):
def __init__(self, _maintype, _subtype, **_params): ...

View File

@@ -0,0 +1,8 @@
# Stubs for email.mime.image (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from email.mime.nonmultipart import MIMENonMultipart
class MIMEImage(MIMENonMultipart):
def __init__(self, _imagedata, _subtype=None, _encoder=..., **_params): ...

View File

@@ -0,0 +1,8 @@
# Stubs for email.mime.message (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from email.mime.nonmultipart import MIMENonMultipart
class MIMEMessage(MIMENonMultipart):
def __init__(self, _msg, _subtype=''): ...

View File

@@ -0,0 +1,8 @@
# Stubs for email.mime.multipart (Python 3.4)
#
# 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 3.4)
#
# 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 3.4)
#
# 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=None): ...

29
stdlib/3/email/parser.pyi Normal file
View File

@@ -0,0 +1,29 @@
# Stubs for email.parser (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
import email.feedparser
FeedParser = email.feedparser.FeedParser
BytesFeedParser = email.feedparser.BytesFeedParser
class Parser:
policy = ... # type: Any
def __init__(self, _class=None, *, policy=...): ...
def parse(self, fp, headersonly=False): ...
def parsestr(self, text, headersonly=False): ...
class HeaderParser(Parser):
def parse(self, fp, headersonly=True): ...
def parsestr(self, text, headersonly=True): ...
class BytesParser:
parser = ... # type: Any
def __init__(self, *args, **kw): ...
def parse(self, fp, headersonly=False): ...
def parsebytes(self, text, headersonly=False): ...
class BytesHeaderParser(BytesParser):
def parse(self, fp, headersonly=True): ...
def parsebytes(self, text, headersonly=True): ...

26
stdlib/3/email/policy.pyi Normal file
View File

@@ -0,0 +1,26 @@
# Stubs for email.policy (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
import email._policybase
Policy = email._policybase.Policy
Compat32 = email._policybase.Compat32
class EmailPolicy(Policy):
refold_source = ... # type: Any
header_factory = ... # type: Any
content_manager = ... # type: Any
def __init__(self, **kw): ...
def header_max_count(self, name): ...
def header_source_parse(self, sourcelines): ...
def header_store_parse(self, name, value): ...
def header_fetch_parse(self, name, value): ...
def fold(self, name, value): ...
def fold_binary(self, name, value): ...
default = ... # type: Any
strict = ... # type: Any
SMTP = ... # type: Any
HTTP = ... # type: Any

View File

@@ -0,0 +1,18 @@
# Stubs for email.quoprimime (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
def header_length(bytearray): ...
def body_length(bytearray): ...
def unquote(s): ...
def quote(c): ...
def header_encode(header_bytes, charset=''): ...
def body_encode(body, maxlinelen=76, eol=...): ...
def decode(encoded, eol=...): ...
body_decode = ... # type: Any
decodestring = ... # type: Any
def header_decode(s): ...

22
stdlib/3/email/utils.pyi Normal file
View File

@@ -0,0 +1,22 @@
# Stubs for email.utils (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
import email._parseaddr
mktime_tz = email._parseaddr.mktime_tz
parsedate = email._parseaddr.parsedate
parsedate_tz = email._parseaddr.parsedate_tz
def formataddr(pair, charset=''): ...
def getaddresses(fieldvalues): ...
def formatdate(timeval=None, localtime=False, usegmt=False): ...
def format_datetime(dt, usegmt=False): ...
def make_msgid(idstring=None, domain=None): ...
def parsedate_to_datetime(data): ...
def parseaddr(addr): ...
def unquote(str): ...
def decode_rfc2231(s): ...
def encode_rfc2231(s, charset=None, language=None): ...
def decode_params(params): ...
def collapse_rfc2231_value(value, errors='', fallback_charset=''): ...

6
stdlib/3/encodings.pyi Normal file
View File

@@ -0,0 +1,6 @@
import codecs
import typing
def search_function(encoding: str) -> codecs.CodecInfo:
...

11
stdlib/3/fnmatch.pyi Normal file
View File

@@ -0,0 +1,11 @@
# Stubs for fnmatch
# Based on http://docs.python.org/3.2/library/fnmatch.html and
# python-lib/fnmatch.py
from typing import Iterable, List, AnyStr
def fnmatch(name: AnyStr, pat: AnyStr) -> bool: ...
def fnmatchcase(name: AnyStr, pat: AnyStr) -> bool: ...
def filter(names: Iterable[AnyStr], pat: AnyStr) -> List[AnyStr]: ...
def translate(pat: str) -> str: ...

12
stdlib/3/functools.pyi Normal file
View File

@@ -0,0 +1,12 @@
# Stubs for functools
# NOTE: These are incomplete!
from typing import Callable, Any, Optional
# TODO implement as class; more precise typing
# TODO cache_info and __wrapped__ attributes
def lru_cache(maxsize: Optional[int] = 100) -> Callable[[Any], Any]: ...
# TODO more precise typing?
def wraps(func: Any) -> Any: ...

19
stdlib/3/getopt.pyi Normal file
View File

@@ -0,0 +1,19 @@
# Stubs for getopt
# Based on http://docs.python.org/3.2/library/getopt.html
from typing import List, Tuple
def getopt(args: List[str], shortopts: str,
longopts: List[str]) -> Tuple[List[Tuple[str, str]],
List[str]]: ...
def gnu_getopt(args: List[str], shortopts: str,
longopts: List[str]) -> Tuple[List[Tuple[str, str]],
List[str]]: ...
class GetoptError(Exception):
msg = ''
opt = ''
error = GetoptError

5
stdlib/3/getpass.pyi Normal file
View File

@@ -0,0 +1,5 @@
# Stubs for getpass
# NOTE: These are incomplete!
def getuser() -> str: ...

39
stdlib/3/gettext.pyi Normal file
View File

@@ -0,0 +1,39 @@
# Stubs for gettext (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class NullTranslations:
def __init__(self, fp=None): ...
def add_fallback(self, fallback): ...
def gettext(self, message): ...
def lgettext(self, message): ...
def ngettext(self, msgid1, msgid2, n): ...
def lngettext(self, msgid1, msgid2, n): ...
def info(self): ...
def charset(self): ...
def output_charset(self): ...
def set_output_charset(self, charset): ...
def install(self, names=None): ...
class GNUTranslations(NullTranslations):
LE_MAGIC = ... # type: Any
BE_MAGIC = ... # type: Any
def lgettext(self, message): ...
def lngettext(self, msgid1, msgid2, n): ...
def gettext(self, message): ...
def ngettext(self, msgid1, msgid2, n): ...
def find(domain, localedir=None, languages=None, all=False): ...
def translation(domain, localedir=None, languages=None, class_=None, fallback=False,
codeset=None): ...
def install(domain, localedir=None, codeset=None, names=None): ...
def textdomain(domain=None): ...
def bindtextdomain(domain, localedir=None): ...
def dgettext(domain, message): ...
def dngettext(domain, msgid1, msgid2, n): ...
def gettext(message): ...
def ngettext(msgid1, msgid2, n): ...
Catalog = ... # type: Any

8
stdlib/3/glob.pyi Normal file
View File

@@ -0,0 +1,8 @@
# Stubs for glob
# Based on http://docs.python.org/3.2/library/glob.html
from typing import List, Iterator, AnyStr
def glob(pathname: AnyStr) -> List[AnyStr]: ...
def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ...

25
stdlib/3/hashlib.pyi Normal file
View File

@@ -0,0 +1,25 @@
# Stubs for hashlib
# NOTE: These are incomplete!
from abc import abstractmethod, ABCMeta
import typing
class Hash(metaclass=ABCMeta):
@abstractmethod
def update(self, arg: bytes) -> None: ...
@abstractmethod
def digest(self) -> bytes: ...
@abstractmethod
def hexdigest(self) -> str: ...
@abstractmethod
def copy(self) -> 'Hash': ...
def md5(arg: bytes = None) -> Hash: ...
def sha1(arg: bytes = None) -> Hash: ...
def sha224(arg: bytes = None) -> Hash: ...
def sha256(arg: bytes = None) -> Hash: ...
def sha384(arg: bytes = None) -> Hash: ...
def sha512(arg: bytes = None) -> Hash: ...
def new(name: str, data: bytes = None) -> Hash: ...

18
stdlib/3/heapq.pyi Normal file
View File

@@ -0,0 +1,18 @@
# Stubs for heapq
# Based on http://docs.python.org/3.2/library/heapq.html
from typing import TypeVar, List, Iterable, Any, Callable
_T = TypeVar('_T')
def heappush(heap: List[_T], item: _T) -> None: ...
def heappop(heap: List[_T]) -> _T: ...
def heappushpop(heap: List[_T], item: _T) -> _T: ...
def heapify(x: List[_T]) -> None: ...
def heapreplace(heap: List[_T], item: _T) -> _T: ...
def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ...
def nlargest(n: int, iterable: Iterable[_T],
key: Callable[[_T], Any] = None) -> List[_T]: ...
def nsmallest(n: int, iterable: Iterable[_T],
key: Callable[[_T], Any] = None) -> List[_T]: ...

View File

101
stdlib/3/http/client.pyi Normal file
View File

@@ -0,0 +1,101 @@
# Stubs for http.client (Python 3.4)
from typing import Any, Dict
import email.message
import io
responses = ... # type: Dict[int, str]
class HTTPMessage(email.message.Message):
def getallmatchingheaders(self, name): ...
class HTTPResponse(io.RawIOBase):
fp = ... # type: Any
debuglevel = ... # type: Any
headers = ... # type: Any
version = ... # type: Any
status = ... # type: Any
reason = ... # type: Any
chunked = ... # type: Any
chunk_left = ... # type: Any
length = ... # type: Any
will_close = ... # type: Any
def __init__(self, sock, debuglevel=0, method=None, url=None): ...
code = ... # type: Any
def begin(self): ...
def close(self): ...
def flush(self): ...
def readable(self): ...
def isclosed(self): ...
def read(self, amt=None): ...
def readinto(self, b): ...
def fileno(self): ...
def getheader(self, name, default=None): ...
def getheaders(self): ...
def __iter__(self): ...
def info(self): ...
def geturl(self): ...
def getcode(self): ...
class HTTPConnection:
response_class = ... # type: Any
default_port = ... # type: Any
auto_open = ... # type: Any
debuglevel = ... # type: Any
mss = ... # type: Any
timeout = ... # type: Any
source_address = ... # type: Any
sock = ... # type: Any
def __init__(self, host, port=None, timeout=..., source_address=None): ...
def set_tunnel(self, host, port=None, headers=None): ...
def set_debuglevel(self, level): ...
def connect(self): ...
def close(self): ...
def send(self, data): ...
def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): ...
def putheader(self, header, *values): ...
def endheaders(self, message_body=None): ...
def request(self, method, url, body=None, headers=...): ...
def getresponse(self): ...
class HTTPSConnection(HTTPConnection):
default_port = ... # type: Any
key_file = ... # type: Any
cert_file = ... # type: Any
def __init__(self, host, port=None, key_file=None, cert_file=None, timeout=...,
source_address=None, *, context=None, check_hostname=None): ...
sock = ... # type: Any
def connect(self): ...
class HTTPException(Exception): ...
class NotConnected(HTTPException): ...
class InvalidURL(HTTPException): ...
class UnknownProtocol(HTTPException):
args = ... # type: Any
version = ... # type: Any
def __init__(self, version): ...
class UnknownTransferEncoding(HTTPException): ...
class UnimplementedFileMode(HTTPException): ...
class IncompleteRead(HTTPException):
args = ... # type: Any
partial = ... # type: Any
expected = ... # type: Any
def __init__(self, partial, expected=None): ...
class ImproperConnectionState(HTTPException): ...
class CannotSendRequest(ImproperConnectionState): ...
class CannotSendHeader(ImproperConnectionState): ...
class ResponseNotReady(ImproperConnectionState): ...
class BadStatusLine(HTTPException):
args = ... # type: Any
line = ... # type: Any
def __init__(self, line): ...
class LineTooLong(HTTPException):
def __init__(self, line_type): ...
error = HTTPException

121
stdlib/3/http/cookiejar.pyi Normal file
View File

@@ -0,0 +1,121 @@
# Stubs for http.cookiejar (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class Cookie:
version = ... # type: Any
name = ... # type: Any
value = ... # type: Any
port = ... # type: Any
port_specified = ... # type: Any
domain = ... # type: Any
domain_specified = ... # type: Any
domain_initial_dot = ... # type: Any
path = ... # type: Any
path_specified = ... # type: Any
secure = ... # type: Any
expires = ... # type: Any
discard = ... # type: Any
comment = ... # type: Any
comment_url = ... # type: Any
rfc2109 = ... # type: Any
def __init__(self, version, name, value, port, port_specified, domain, domain_specified,
domain_initial_dot, path, path_specified, secure, expires, discard, comment,
comment_url, rest, rfc2109=False): ...
def has_nonstandard_attr(self, name): ...
def get_nonstandard_attr(self, name, default=None): ...
def set_nonstandard_attr(self, name, value): ...
def is_expired(self, now=None): ...
class CookiePolicy:
def set_ok(self, cookie, request): ...
def return_ok(self, cookie, request): ...
def domain_return_ok(self, domain, request): ...
def path_return_ok(self, path, request): ...
class DefaultCookiePolicy(CookiePolicy):
DomainStrictNoDots = ... # type: Any
DomainStrictNonDomain = ... # type: Any
DomainRFC2965Match = ... # type: Any
DomainLiberal = ... # type: Any
DomainStrict = ... # type: Any
netscape = ... # type: Any
rfc2965 = ... # type: Any
rfc2109_as_netscape = ... # type: Any
hide_cookie2 = ... # type: Any
strict_domain = ... # type: Any
strict_rfc2965_unverifiable = ... # type: Any
strict_ns_unverifiable = ... # type: Any
strict_ns_domain = ... # type: Any
strict_ns_set_initial_dollar = ... # type: Any
strict_ns_set_path = ... # type: Any
def __init__(self, blocked_domains=None, allowed_domains=None, netscape=True, rfc2965=False,
rfc2109_as_netscape=None, hide_cookie2=False, strict_domain=False,
strict_rfc2965_unverifiable=True, strict_ns_unverifiable=False,
strict_ns_domain=..., strict_ns_set_initial_dollar=False,
strict_ns_set_path=False): ...
def blocked_domains(self): ...
def set_blocked_domains(self, blocked_domains): ...
def is_blocked(self, domain): ...
def allowed_domains(self): ...
def set_allowed_domains(self, allowed_domains): ...
def is_not_allowed(self, domain): ...
def set_ok(self, cookie, request): ...
def set_ok_version(self, cookie, request): ...
def set_ok_verifiability(self, cookie, request): ...
def set_ok_name(self, cookie, request): ...
def set_ok_path(self, cookie, request): ...
def set_ok_domain(self, cookie, request): ...
def set_ok_port(self, cookie, request): ...
def return_ok(self, cookie, request): ...
def return_ok_version(self, cookie, request): ...
def return_ok_verifiability(self, cookie, request): ...
def return_ok_secure(self, cookie, request): ...
def return_ok_expires(self, cookie, request): ...
def return_ok_port(self, cookie, request): ...
def return_ok_domain(self, cookie, request): ...
def domain_return_ok(self, domain, request): ...
def path_return_ok(self, path, request): ...
class Absent: ...
class CookieJar:
non_word_re = ... # type: Any
quote_re = ... # type: Any
strict_domain_re = ... # type: Any
domain_re = ... # type: Any
dots_re = ... # type: Any
magic_re = ... # type: Any
def __init__(self, policy=None): ...
def set_policy(self, policy): ...
def add_cookie_header(self, request): ...
def make_cookies(self, response, request): ...
def set_cookie_if_ok(self, cookie, request): ...
def set_cookie(self, cookie): ...
def extract_cookies(self, response, request): ...
def clear(self, domain=None, path=None, name=None): ...
def clear_session_cookies(self): ...
def clear_expired_cookies(self): ...
def __iter__(self): ...
def __len__(self): ...
class LoadError(OSError): ...
class FileCookieJar(CookieJar):
filename = ... # type: Any
delayload = ... # type: Any
def __init__(self, filename=None, delayload=False, policy=None): ...
def save(self, filename=None, ignore_discard=False, ignore_expires=False): ...
def load(self, filename=None, ignore_discard=False, ignore_expires=False): ...
def revert(self, filename=None, ignore_discard=False, ignore_expires=False): ...
class LWPCookieJar(FileCookieJar):
def as_lwp_str(self, ignore_discard=True, ignore_expires=True): ...
def save(self, filename=None, ignore_discard=False, ignore_expires=False): ...
class MozillaCookieJar(FileCookieJar):
magic_re = ... # type: Any
header = ... # type: Any
def save(self, filename=None, ignore_discard=False, ignore_expires=False): ...

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

@@ -0,0 +1,9 @@
# Stubs for importlib
# NOTE: These are incomplete!
from typing import Any
# TODO more precise type?
def import_module(name: str, package: str = None) -> Any: ...
def invalidate_caches() -> None: ...

31
stdlib/3/inspect.pyi Normal file
View File

@@ -0,0 +1,31 @@
# Stubs for inspect
from typing import Any, Tuple, List, Callable
_object = object
def getmembers(obj: object, predicate: Callable[[Any], bool]) -> List[Tuple[str, object]]: ...
def isclass(obj: object) -> bool: ...
# namedtuple('Attribute', 'name kind defining_class object')
class Attribute(tuple):
name = ... # type: str
kind = ... # type: str
defining_class = ... # type: type
object = ... # type: _object
def classify_class_attrs(cls: type) -> List[Attribute]: ...
def cleandoc(doc: str) -> str: ...
def getsourcelines(obj: object) -> Tuple[List[str], int]: ...
# namedtuple('ArgSpec', 'args varargs keywords defaults')
class ArgSpec(tuple):
args = ... # type: List[str]
varargs = ... # type: str
keywords = ... # type: str
defaults = ... # type: tuple
def getargspec(func: object) -> ArgSpec: ...

150
stdlib/3/io.pyi Normal file
View File

@@ -0,0 +1,150 @@
# Stubs for io
# Based on http://docs.python.org/3.2/library/io.html
from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Any
import builtins
import codecs
import _io
DEFAULT_BUFFER_SIZE = 0 # type: int
SEEK_SET = ... # type: int
SEEK_CUR = ... # type: int
SEEK_END = ... # type: int
open = builtins.open
class BlockingIOError(OSError): ...
class UnsupportedOperation(ValueError, OSError): ...
class IncrementalNewlineDecoder(codecs.IncrementalDecoder):
newlines = ... # type: Any
def __init__(self, *args, **kwargs): ...
def decode(self, input, final=False): ...
def getstate(self): ...
def reset(self): ...
def setstate(self, state): ...
class IOBase(_io._IOBase): ...
class RawIOBase(_io._RawIOBase, IOBase): ...
class BufferedIOBase(_io._BufferedIOBase, IOBase): ...
class TextIOBase(_io._TextIOBase, IOBase): ...
class FileIO(_io._RawIOBase):
closefd = ... # type: Any
mode = ... # type: Any
def __init__(self, name, mode=..., closefd=..., opener=...): ...
def readinto(self, b): ...
def write(self, b): ...
class BufferedReader(_io._BufferedIOBase):
mode = ... # type: Any
name = ... # type: Any
raw = ... # type: Any
def __init__(self, raw, buffer_size=...): ...
def peek(self, size: int = -1): ...
class BufferedWriter(_io._BufferedIOBase):
mode = ... # type: Any
name = ... # type: Any
raw = ... # type: Any
def __init__(self, raw, buffer_size=...): ...
class BufferedRWPair(_io._BufferedIOBase):
def __init__(self, reader, writer, buffer_size=...): ...
def peek(self, size: int = -1): ...
class BufferedRandom(_io._BufferedIOBase):
mode = ... # type: Any
name = ... # type: Any
raw = ... # type: Any
def __init__(self, raw, buffer_size=...): ...
def peek(self, size: int = -1): ...
class BytesIO(BinaryIO):
def __init__(self, initial_bytes: bytes = b'') -> None: ...
# TODO getbuffer
# TODO see comments in BinaryIO for missing functionality
def close(self) -> None: ...
@property
def closed(self) -> bool: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, n: int = -1) -> bytes: ...
def readable(self) -> bool: ...
def readline(self, limit: int = -1) -> bytes: ...
def readlines(self, hint: int = -1) -> List[bytes]: ...
def seek(self, offset: int, whence: int = 0) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: int = None) -> int: ...
def writable(self) -> bool: ...
@overload
def write(self, s: bytes) -> int: ...
@overload
def write(self, s: bytearray) -> int: ...
def writelines(self, lines: Iterable[bytes]) -> None: ...
def getvalue(self) -> bytes: ...
def read1(self) -> str: ...
def __iter__(self) -> Iterator[bytes]: ...
def __enter__(self) -> 'BytesIO': ...
def __exit__(self, type, value, traceback) -> bool: ...
class StringIO(TextIO):
def __init__(self, initial_value: str = '',
newline: str = None) -> None: ...
# TODO see comments in BinaryIO for missing functionality
def close(self) -> None: ...
@property
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) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: int = None) -> int: ...
def writable(self) -> bool: ...
def write(self, s: str) -> int: ...
def writelines(self, lines: Iterable[str]) -> None: ...
def getvalue(self) -> str: ...
def __iter__(self) -> Iterator[str]: ...
def __enter__(self) -> 'StringIO': ...
def __exit__(self, type, value, traceback) -> bool: ...
class TextIOWrapper(TextIO):
# TODO: This is actually a base class of _io._TextIOBase.
# write_through is undocumented but used by subprocess
def __init__(self, buffer: IO[bytes], encoding: str = None,
errors: str = None, newline: str = None,
line_buffering: bool = False,
write_through: bool = True) -> None: ...
# TODO see comments in BinaryIO for missing functionality
def close(self) -> None: ...
@property
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) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: int = None) -> int: ...
def writable(self) -> bool: ...
def write(self, s: str) -> int: ...
def writelines(self, lines: Iterable[str]) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def __enter__(self) -> StringIO: ...
def __exit__(self, type, value, traceback) -> bool: ...

12
stdlib/3/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) -> str: ...
def dump(obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ...
def loads(s: str) -> Any: ...
def load(fp: IO[str]) -> Any: ...

5
stdlib/3/linecache.pyi Normal file
View File

@@ -0,0 +1,5 @@
from typing import Any
def getline(filename:str, lineno:int, module_globals: Any=None) -> str: pass
def clearcache() -> None: pass
def getlines(filename: str, module_globals: Any=None) -> None: pass

17
stdlib/3/locale.pyi Normal file
View File

@@ -0,0 +1,17 @@
# Stubs for locale (Python 3.4)
#
# NOTE: This stub is based on a stub automatically generated by stubgen.
from _locale import *
def format(percent, value, grouping=False, monetary=False, *additional): ...
def format_string(f, val, grouping=False): ...
def currency(val, symbol=True, grouping=False, international=False): ...
def str(val): ...
def atof(string, func=...): ...
def atoi(str): ...
def normalize(localename): ...
def getdefaultlocale(envvars=...): ...
def getlocale(category=...): ...
def resetlocale(category=...): ...
def getpreferredencoding(do_setlocale=True): ...

View File

@@ -0,0 +1,239 @@
# Stubs for logging (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
CRITICAL = ... # type: Any
FATAL = ... # type: Any
ERROR = ... # type: Any
WARNING = ... # type: Any
WARN = ... # type: Any
INFO = ... # type: Any
DEBUG = ... # type: Any
NOTSET = ... # type: Any
def getLevelName(level): ...
def addLevelName(level, levelName): ...
class LogRecord:
name = ... # type: Any
msg = ... # type: Any
args = ... # type: Any
levelname = ... # type: Any
levelno = ... # type: Any
pathname = ... # type: Any
filename = ... # type: Any
module = ... # type: Any
exc_info = ... # type: Any
exc_text = ... # type: Any
stack_info = ... # type: Any
lineno = ... # type: Any
funcName = ... # type: Any
created = ... # type: Any
msecs = ... # type: Any
relativeCreated = ... # type: Any
thread = ... # type: Any
threadName = ... # type: Any
processName = ... # type: Any
process = ... # type: Any
def __init__(self, name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None,
**kwargs): ...
def getMessage(self): ...
def setLogRecordFactory(factory): ...
def getLogRecordFactory(): ...
def makeLogRecord(dict): ...
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=None, datefmt=None, style=''): ...
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): ...
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=''): ...
def filter(self, record): ...
class Filterer:
filters = ... # type: Any
def __init__(self): ...
def addFilter(self, filter): ...
def removeFilter(self, filter): ...
def filter(self, record): ...
class Handler(Filterer):
level = ... # type: Any
formatter = ... # type: Any
def __init__(self, level=...): ...
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): ...
def format(self, record): ...
def emit(self, record): ...
def handle(self, record): ...
def setFormatter(self, fmt): ...
def flush(self): ...
def close(self): ...
def handleError(self, record): ...
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, mode='', encoding=None, delay=False): ...
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 = ... # type: Any
handlers = ... # type: Any
disabled = ... # type: Any
def __init__(self, name, level=...): ...
def setLevel(self, level): ...
def debug(self, msg, *args, **kwargs): ...
def info(self, msg, *args, **kwargs): ...
def warning(self, msg, *args, **kwargs): ...
def warn(self, msg, *args, **kwargs): ...
def error(self, msg, *args, **kwargs): ...
def exception(self, msg, *args, **kwargs): ...
def critical(self, msg, *args, **kwargs): ...
fatal = ... # type: Any
def log(self, level, msg, *args, **kwargs): ...
def findCaller(self, stack_info=False): ...
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): ...
def removeHandler(self, hdlr): ...
def hasHandlers(self): ...
def callHandlers(self, record): ...
def getEffectiveLevel(self): ...
def isEnabledFor(self, level): ...
def getChild(self, suffix): ...
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, *args, **kwargs): ...
def info(self, msg, *args, **kwargs): ...
def warning(self, msg, *args, **kwargs): ...
def warn(self, msg, *args, **kwargs): ...
def error(self, msg, *args, **kwargs): ...
def exception(self, msg, *args, **kwargs): ...
def critical(self, msg, *args, **kwargs): ...
def log(self, level, msg, *args, **kwargs): ...
def isEnabledFor(self, level): ...
def setLevel(self, level): ...
def getEffectiveLevel(self): ...
def hasHandlers(self): ...
def basicConfig(**kwargs): ...
def getLogger(name=None): ...
def critical(msg, *args, **kwargs): ...
fatal = ... # type: Any
def error(msg, *args, **kwargs): ...
def exception(msg, *args, **kwargs): ...
def warning(msg, *args, **kwargs): ...
def warn(msg, *args, **kwargs): ...
def info(msg, *args, **kwargs): ...
def debug(msg, *args, **kwargs): ...
def log(level, msg, *args, **kwargs): ...
def disable(level): ...
class NullHandler(Handler):
def handle(self, record): ...
def emit(self, record): ...
lock = ... # type: Any
def createLock(self): ...
def captureWarnings(capture): ...

View File

@@ -0,0 +1,200 @@
# Stubs for logging.handlers (Python 3.4)
#
# 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=False): ...
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, mode='', maxBytes=0, backupCount=0, encoding=None,
delay=False): ...
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=False,
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, mode='', encoding=None, delay=False): ...
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): ...
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): ...

8
stdlib/3/msvcrt.pyi Normal file
View File

@@ -0,0 +1,8 @@
# Stubs for msvcrt
# NOTE: These are incomplete!
from typing import overload, BinaryIO, TextIO
def get_osfhandle(file: int) -> int: ...
def open_osfhandle(handle: int, flags: int) -> int: ...

View File

@@ -0,0 +1,12 @@
# Stubs for multiprocessing
from typing import Any
class Lock(): ...
class Process(): ...
class Queue():
def get(block: bool = None, timeout: float = None) -> Any: ...
class Value():
def __init__(typecode_or_type: str, *args: Any, lock: bool = True) -> None: ...

View File

@@ -0,0 +1,8 @@
# Stubs for multiprocessing.managers
# NOTE: These are incomplete!
from typing import Any
class BaseManager():
def register(typeid: str, callable: Any = None) -> None: ...

View File

@@ -0,0 +1,6 @@
# Stubs for multiprocessing.pool
# NOTE: These are incomplete!
class ThreadPool():
def __init__(self, processes: int = None) -> None: ...

338
stdlib/3/os/__init__.pyi Normal file
View File

@@ -0,0 +1,338 @@
# Stubs for os
# Ron Murawski <ron@horizonchess.com>
# based on http://docs.python.org/3.2/library/os.html
from typing import (
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr,
Optional, Generic
)
from builtins import OSError as error
import os.path as path
# ----- os variables -----
supports_bytes_environ = False # TODO: True when bytes implemented?
SEEK_SET = 0 # type: int
SEEK_CUR = 1 # type: int
SEEK_END = 2 # type: int
O_RDONLY = 0
O_WRONLY = 0
O_RDWR = 0
O_APPEND = 0
O_CREAT = 0
O_EXCL = 0
O_TRUNC = 0
O_DSYNC = 0 # Unix only
O_RSYNC = 0 # Unix only
O_SYNC = 0 # Unix only
O_NDELAY = 0 # Unix only
O_NONBLOCK = 0 # Unix only
O_NOCTTY = 0 # Unix only
O_SHLOCK = 0 # Unix only
O_EXLOCK = 0 # Unix only
O_BINARY = 0 # Windows only
O_NOINHERIT = 0 # Windows only
O_SHORT_LIVED = 0# Windows only
O_TEMPORARY = 0 # Windows only
O_RANDOM = 0 # Windows only
O_SEQUENTIAL = 0 # Windows only
O_TEXT = 0 # Windows only
O_ASYNC = 0 # Gnu extension if in C library
O_DIRECT = 0 # Gnu extension if in C library
O_DIRECTORY = 0 # Gnu extension if in C library
O_NOFOLLOW = 0 # Gnu extension if in C library
O_NOATIME = 0 # Gnu extension if in C library
curdir = ''
pardir = ''
sep = ''
altsep = ''
extsep = ''
pathsep = ''
defpath = ''
linesep = ''
devnull = ''
F_OK = 0
R_OK = 0
W_OK = 0
X_OK = 0
class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]):
def copy(self) -> _Environ[AnyStr]: ...
environ = ... # type: _Environ[str]
environb = ... # type: _Environ[bytes]
confstr_names = ... # type: Dict[str, int] # Unix only
pathconf_names = ... # type: Dict[str, int] # Unix only
sysconf_names = ... # type: Dict[str, int] # Unix only
EX_OK = 0 # Unix only
EX_USAGE = 0 # Unix only
EX_DATAERR = 0 # Unix only
EX_NOINPUT = 0 # Unix only
EX_NOUSER = 0 # Unix only
EX_NOHOST = 0 # Unix only
EX_UNAVAILABLE = 0 # Unix only
EX_SOFTWARE = 0 # Unix only
EX_OSERR = 0 # Unix only
EX_OSFILE = 0 # Unix only
EX_CANTCREAT = 0 # Unix only
EX_IOERR = 0 # Unix only
EX_TEMPFAIL = 0 # Unix only
EX_PROTOCOL = 0 # Unix only
EX_NOPERM = 0 # Unix only
EX_CONFIG = 0 # Unix only
EX_NOTFOUND = 0 # Unix only
P_NOWAIT = 0
P_NOWAITO = 0
P_WAIT = 0
#P_DETACH = 0 # Windows only
#P_OVERLAY = 0 # Windows only
# wait()/waitpid() options
WNOHANG = 0 # Unix only
#WCONTINUED = 0 # some Unix systems
#WUNTRACED = 0 # Unix only
TMP_MAX = 0 # Undocumented, but used by tempfile
# ----- os classes (structures) -----
class stat_result:
# For backward compatibility, the return value of stat() is also
# accessible as a tuple of at least 10 integers giving the most important
# (and portable) members of the stat structure, in the order st_mode,
# st_ino, st_dev, st_nlink, st_uid, st_gid, st_size, st_atime, st_mtime,
# st_ctime. More items may be added at the end by some implementations.
st_mode = 0 # protection bits,
st_ino = 0 # inode number,
st_dev = 0 # device,
st_nlink = 0 # number of hard links,
st_uid = 0 # user id of owner,
st_gid = 0 # group id of owner,
st_size = 0 # size of file, in bytes,
st_atime = 0.0 # time of most recent access,
st_mtime = 0.0 # time of most recent content modification,
st_ctime = 0.0 # platform dependent (time of most recent metadata change
# on Unix, or the time of creation on Windows)
def __init__(self, tuple) -> None: ...
# On some Unix systems (such as Linux), the following attributes may also
# be available:
st_blocks = 0 # number of blocks allocated for file
st_blksize = 0 # filesystem blocksize
st_rdev = 0 # type of device if an inode device
st_flags = 0 # user defined flags for file
# On other Unix systems (such as FreeBSD), the following attributes may be
# available (but may be only filled out if root tries to use them):
st_gen = 0 # file generation number
st_birthtime = 0 # time of file creation
# On Mac OS systems, the following attributes may also be available:
st_rsize = 0
st_creator = 0
st_type = 0
class statvfs_result: # Unix only
f_bsize = 0
f_frsize = 0
f_blocks = 0
f_bfree = 0
f_bavail = 0
f_files = 0
f_ffree = 0
f_favail = 0
f_flag = 0
f_namemax = 0
# ----- os function stubs -----
def name() -> str: ...
def fsencode(filename: str) -> bytes: ...
def fsdecode(filename: bytes) -> str: ...
def get_exec_path(env=None) -> List[str] : ...
# NOTE: get_exec_path(): returns List[bytes] when env not None
def ctermid() -> str: ... # Unix only
def getegid() -> int: ... # Unix only
def geteuid() -> int: ... # Unix only
def getgid() -> int: ... # Unix only
def getgroups() -> List[int]: ... # Unix only, behaves differently on Mac
def initgroups(username: str, gid: int) -> None: ... # Unix only
def getlogin() -> str: ...
def getpgid(pid: int) -> int: ... # Unix only
def getpgrp() -> int: ... # Unix only
def getpid() -> int: ...
def getppid() -> int: ...
def getresuid() -> Tuple[int, int, int]: ... # Unix only
def getresgid() -> Tuple[int, int, int]: ... # Unix only
def getuid() -> int: ... # Unix only
def getenv(key: str, default: str = None) -> str: ...
def getenvb(key: bytes, default: bytes = None) -> bytes: ...
# TODO mixed str/bytes putenv arguments
def putenv(key: AnyStr, value: AnyStr) -> None: ...
def setegid(egid: int) -> None: ... # Unix only
def seteuid(euid: int) -> None: ... # Unix only
def setgid(gid: int) -> None: ... # Unix only
def setgroups(groups: List[int]) -> None: ... # Unix only
def setpgrp() -> int: ... # Unix only
def setpgid(pid: int, pgrp: int) -> int: ... # Unix only
def setregid(rgid: int, egid: int) -> None: ... # Unix only
def setresgid(rgid: int, egid: int, sgid: int) -> None: ... # Unix only
def setresuid(ruid: int, euid: int, suid: int) -> None: ... # Unix only
def setreuid(ruid: int, euid: int) -> None: ... # Unix only
def getsid(pid: int) -> int: ... # Unix only
def setsid() -> int: ... # Unix only
def setuid(uid) -> None: ... # Unix only
def strerror(code: int) -> str: ...
def umask(mask: int) -> int: ...
def uname() -> Tuple[str, str, str, str, str]: ... # Unix only
def unsetenv(key: AnyStr) -> None: ...
# Return IO or TextIO
def fdopen(fd: int, mode: str = 'r', encoding: str = None, errors: str = None,
newline: str = None, closefd: bool = True) -> Any: ...
def close(fd: int) -> None: ...
def closerange(fd_low: int, fd_high: int) -> None: ...
def device_encoding(fd: int) -> Optional[str]: ...
def dup(fd: int) -> int: ...
def dup2(fd: int, fd2: int) -> None: ...
def fchmod(fd: int, intmode) -> None: ... # Unix only
def fchown(fd: int, uid: int, gid: int) -> None: ... # Unix only
def fdatasync(fd: int) -> None: ... # Unix only, not Mac
def fpathconf(fd: int, name: str) -> int: ... # Unix only
def fstat(fd: int) -> stat_result: ...
def fstatvfs(fd: int) -> statvfs_result: ... # Unix only
def fsync(fd: int) -> None: ...
def ftruncate(fd: int, length: int) -> None: ... # Unix only
def isatty(fd: int) -> bool: ... # Unix only
def lseek(fd: int, pos: int, how: int) -> int: ...
def open(file: AnyStr, flags: int, mode: int = 0o777) -> int: ...
def openpty() -> Tuple[int, int]: ... # some flavors of Unix
def pipe() -> Tuple[int, int]: ...
def read(fd: int, n: int) -> bytes: ...
def tcgetpgrp(fd: int) -> int: ... # Unix only
def tcsetpgrp(fd: int, pg: int) -> None: ... # Unix only
def ttyname(fd: int) -> str: ... # Unix only
def write(fd: int, string: bytes) -> int: ...
def access(path: AnyStr, mode: int) -> bool: ...
def chdir(path: AnyStr) -> None: ...
def fchdir(fd: int) -> None: ...
def getcwd() -> str: ...
def getcwdb() -> bytes: ...
def chflags(path: str, flags: int) -> None: ... # Unix only
def chroot(path: str) -> None: ... # Unix only
def chmod(path: AnyStr, mode: int) -> None: ...
def chown(path: AnyStr, uid: int, gid: int) -> None: ... # Unix only
def lchflags(path: str, flags: int) -> None: ... # Unix only
def lchmod(path: str, mode: int) -> None: ... # Unix only
def lchown(path: str, uid: int, gid: int) -> None: ... # Unix only
def link(src: AnyStr, link_name: AnyStr) -> None: ...
@overload
def listdir(path: str = '.') -> List[str]: ...
@overload
def listdir(path: bytes) -> List[bytes]: ...
def lstat(path: AnyStr) -> stat_result: ...
def mkfifo(path, mode: int=0o666) -> None: ... # Unix only
def mknod(filename: AnyStr, mode: int = 0o600, device: int = 0) -> None: ...
def major(device: int) -> int: ...
def minor(device: int) -> int: ...
def makedev(major: int, minor: int) -> int: ...
def mkdir(path: AnyStr, mode: int = 0o777) -> None: ...
def makedirs(path: AnyStr, mode: int = 0o777,
exist_ok: bool = False) -> None: ...
def pathconf(path: str, name: str) -> int: ... # Unix only
def readlink(path: AnyStr) -> AnyStr: ...
def remove(path: AnyStr) -> None: ...
def removedirs(path: AnyStr) -> None: ...
def rename(src: AnyStr, dst: AnyStr) -> None: ...
def renames(old: AnyStr, new: AnyStr) -> None: ...
def rmdir(path: AnyStr) -> None: ...
def stat(path: AnyStr) -> stat_result: ...
def stat_float_times(newvalue: Union[bool, None] = None) -> bool: ...
def statvfs(path: str) -> statvfs_result: ... # Unix only
def symlink(source: AnyStr, link_name: AnyStr,
target_is_directory: bool = False) -> None:
... # final argument in Windows only
def unlink(path: AnyStr) -> None: ...
def utime(path: AnyStr, times: Union[Tuple[int, int], Tuple[float, float]] = None) -> None: ...
# TODO onerror: function from OSError to void
def walk(top: AnyStr, topdown: bool = True, onerror: Any = None,
followlinks: bool = False) -> Iterator[Tuple[AnyStr, List[AnyStr],
List[AnyStr]]]: ...
# walk(): "By default errors from the os.listdir() call are ignored. If
# optional arg 'onerror' is specified, it should be a function; it
# will be called with one argument, an os.error instance. It can
# report the error to continue with the walk, or raise the exception
# to abort the walk. Note that the filename is available as the
# filename attribute of the exception object."
def abort() -> 'None': ...
def execl(path: AnyStr, arg0: AnyStr, *args: AnyStr) -> None: ...
def execle(path: AnyStr, arg0: AnyStr,
*args: Any) -> None: ... # Imprecise signature
def execlp(path: AnyStr, arg0: AnyStr, *args: AnyStr) -> None: ...
def execlpe(path: AnyStr, arg0: AnyStr,
*args: Any) -> None: ... # Imprecise signature
def execv(path: AnyStr, args: List[AnyStr]) -> None: ...
def execve(path: AnyStr, args: List[AnyStr], env: Mapping[AnyStr, AnyStr]) -> None: ...
def execvp(file: AnyStr, args: List[AnyStr]) -> None: ...
def execvpe(file: AnyStr, args: List[AnyStr],
env: Mapping[str, str]) -> None: ...
def _exit(n: int) -> None: ...
def fork() -> int: ... # Unix only
def forkpty() -> Tuple[int, int]: ... # some flavors of Unix
def kill(pid: int, sig: int) -> None: ...
def killpg(pgid: int, sig: int) -> None: ... # Unix only
def nice(increment: int) -> int: ... # Unix only
def plock(op: int) -> None: ... # Unix only ???op is int?
from io import TextIOWrapper as _TextIOWrapper
class popen(_TextIOWrapper):
# TODO 'b' modes or bytes command not accepted?
def __init__(self, command: str, mode: str = 'r',
bufsize: int = -1) -> None: ...
def close(self) -> Any: ... # may return int
def spawnl(mode: int, path: AnyStr, arg0: AnyStr, *args: AnyStr) -> int: ...
def spawnle(mode: int, path: AnyStr, arg0: AnyStr,
*args: Any) -> int: ... # Imprecise sig
def spawnlp(mode: int, file: AnyStr, arg0: AnyStr,
*args: AnyStr) -> int: ... # Unix only TODO
def spawnlpe(mode: int, file: AnyStr, arg0: AnyStr, *args: Any) -> int:
... # Imprecise signature; Unix only TODO
def spawnv(mode: int, path: AnyStr, args: List[AnyStr]) -> int: ...
def spawnve(mode: int, path: AnyStr, args: List[AnyStr],
env: Mapping[str, str]) -> int: ...
def spawnvp(mode: int, file: AnyStr, args: List[AnyStr]) -> int: ... # Unix only
def spawnvpe(mode: int, file: AnyStr, args: List[AnyStr],
env: Mapping[str, str]) -> int:
... # Unix only
def startfile(path: str, operation: Union[str, None] = None) -> None: ... # Windows only
def system(command: AnyStr) -> int: ...
def times() -> Tuple[float, float, float, float, float]: ...
def wait() -> Tuple[int, int]: ... # Unix only
def waitpid(pid: int, options: int) -> Tuple[int, int]: ...
def wait3(options: Union[int, None] = None) -> Tuple[int, int, Any]: ... # Unix only
def wait4(pid: int, options: int) -> Tuple[int, int, Any]:
... # Unix only
def WCOREDUMP(status: int) -> bool: ... # Unix only
def WIFCONTINUED(status: int) -> bool: ... # Unix only
def WIFSTOPPED(status: int) -> bool: ... # Unix only
def WIFSIGNALED(status: int) -> bool: ... # Unix only
def WIFEXITED(status: int) -> bool: ... # Unix only
def WEXITSTATUS(status: int) -> bool: ... # Unix only
def WSTOPSIG(status: int) -> bool: ... # Unix only
def WTERMSIG(status: int) -> bool: ... # Unix only
def confstr(name: str) -> str: ... # Unix only
def getloadavg() -> Tuple[float, float, float]: ... # Unix only
def sysconf(name: str) -> int: ... # Unix only
def urandom(n: int) -> bytes: ...

61
stdlib/3/os/path.pyi Normal file
View File

@@ -0,0 +1,61 @@
# Stubs for os.path
# Ron Murawski <ron@horizonchess.com>
# based on http://docs.python.org/3.2/library/os.path.html
from typing import overload, List, Any, AnyStr, Tuple, BinaryIO, TextIO
# ----- 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: ...
# NOTE: Empty List[bytes] results in '' (str) => fall back to Any return type.
def commonprefix(list: List[AnyStr]) -> Any: ...
def dirname(path: AnyStr) -> AnyStr: ...
def exists(path: AnyStr) -> bool: ...
def lexists(path: AnyStr) -> bool: ...
def expanduser(path: AnyStr) -> AnyStr: ...
def expandvars(path: AnyStr) -> AnyStr: ...
# These return float if os.stat_float_times() == True
def getatime(path: AnyStr) -> Any: ...
def getmtime(path: AnyStr) -> Any: ...
def getctime(path: AnyStr) -> Any: ...
def getsize(path: AnyStr) -> int: ...
def isabs(path: AnyStr) -> bool: ...
def isfile(path: AnyStr) -> bool: ...
def isdir(path: AnyStr) -> bool: ...
def islink(path: AnyStr) -> bool: ...
def ismount(path: AnyStr) -> 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: AnyStr, path2: AnyStr) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
#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: str) -> Tuple[str, str]: ... # Windows only, deprecated

12
stdlib/3/pickle.pyi Normal file
View File

@@ -0,0 +1,12 @@
# Stubs for pickle
# NOTE: These are incomplete!
from typing import Any, IO
def dumps(obj: Any, protocol: int = None, *,
fix_imports: bool = True) -> bytes: ...
def loads(p: bytes, *, fix_imports: bool = True,
encoding: str = 'ASCII', errors: str = 'strict') -> Any: ...
def load(file: IO[bytes], *, fix_imports: bool = True, encoding: str = 'ASCII',
errors: str = 'strict') -> Any: ...

9
stdlib/3/platform.pyi Normal file
View File

@@ -0,0 +1,9 @@
# Stubs for platform
# NOTE: These are incomplete!
from typing import Tuple
def mac_ver(release: str = '',
version_info: Tuple[str, str, str] = ('', '', ''),
machine: str = '') -> Tuple[str, Tuple[str, str, str], str]: ...

46
stdlib/3/posixpath.pyi Normal file
View File

@@ -0,0 +1,46 @@
# Stubs for os.path
# Ron Murawski <ron@horizonchess.com>
# based on http://docs.python.org/3.2/library/os.path.html
from typing import Any, List, Tuple, IO
# ----- os.path variables -----
supports_unicode_filenames = False
# ----- os.path function stubs -----
def abspath(path: str) -> str: ...
def basename(path) -> str: ...
def commonprefix(list: List[str]) -> str: ...
def dirname(path: str) -> str: ...
def exists(path: str) -> bool: ...
def lexists(path: str) -> bool: ...
def expanduser(path: str) -> str: ...
def expandvars(path: str) -> str: ...
def getatime(path: str) -> int:
... # return float if os.stat_float_times() returns True
def getmtime(path: str) -> int:
... # return float if os.stat_float_times() returns True
def getctime(path: str) -> int:
... # return float if os.stat_float_times() returns True
def getsize(path: str) -> int: ...
def isabs(path: str) -> bool: ...
def isfile(path: str) -> bool: ...
def isdir(path: str) -> bool: ...
def islink(path: str) -> bool: ...
def ismount(path: str) -> bool: ...
def join(path: str, *paths: str) -> str: ...
def normcase(path: str) -> str: ...
def normpath(path: str) -> str: ...
def realpath(path: str) -> str: ...
def relpath(path: str, start: str = None) -> str: ...
def samefile(path1: str, path2: str) -> bool: ...
def sameopenfile(fp1: IO[Any], fp2: IO[Any]) -> bool: ...
#def samestat(stat1: stat_result, stat2: stat_result) -> bool:
# ... # Unix only
def split(path: str) -> Tuple[str, str]: ...
def splitdrive(path: str) -> Tuple[str, str]: ...
def splitext(path: str) -> Tuple[str, str]: ...
#def splitunc(path: str) -> Tuple[str, str] : ... # Windows only, deprecated

23
stdlib/3/pprint.pyi Normal file
View File

@@ -0,0 +1,23 @@
# Stubs for pprint
# Based on http://docs.python.org/3.2/library/pprint.html
from typing import Any, Dict, Tuple, TextIO
def pformat(o: object, indent: int = 1, width: int = 80,
depth: int = None) -> str: ...
def pprint(o: object, stream: TextIO = None, indent: int = 1, width: int = 80,
depth: int = None) -> None: ...
def isreadable(o: object) -> bool: ...
def isrecursive(o: object) -> bool: ...
def saferepr(o: object) -> str: ...
class PrettyPrinter:
def __init__(self, indent: int = 1, width: int = 80, depth: int = None,
stream: TextIO = None) -> None: ...
def pformat(self, o: object) -> str: ...
def pprint(self, o: object) -> None: ...
def isreadable(self, o: object) -> bool: ...
def isrecursive(self, o: object) -> bool: ...
def format(self, o: object, context: Dict[int, Any], maxlevels: int,
level: int) -> Tuple[str, bool, bool]: ...

20
stdlib/3/queue.pyi Normal file
View File

@@ -0,0 +1,20 @@
# Stubs for queue
# NOTE: These are incomplete!
from typing import Any, TypeVar, Generic
_T = TypeVar('_T')
class Queue(Generic[_T]):
def __init__(self, maxsize: int = 0) -> None: ...
def full(self) -> bool: ...
def get(self, block: bool = True, timeout: float = None) -> _T: ...
def get_nowait(self) -> _T: ...
def put(self, item: _T, block: bool = True, timeout: float = None) -> None: ...
def put_nowait(self, item: _T) -> None: ...
def join(self) -> None: ...
def qsize(self) -> int: ...
def task_done(self) -> None: pass
class Empty: ...

70
stdlib/3/random.pyi Normal file
View File

@@ -0,0 +1,70 @@
# Stubs for random
# Ron Murawski <ron@horizonchess.com>
# Updated by Jukka Lehtosalo
# based on http://docs.python.org/3.2/library/random.html
# ----- random classes -----
import _random
from typing import (
Any, TypeVar, Sequence, List, Callable, AbstractSet, Union
)
_T = TypeVar('_T')
class Random(_random.Random):
def __init__(self, x: Any = None) -> None: ...
def seed(self, a: Any = None, version: int = 2) -> None: ...
def getstate(self) -> tuple: ...
def setstate(self, state: tuple) -> None: ...
def getrandbits(self, k: int) -> int: ...
def randrange(self, start: int, stop: Union[int, None] = None, 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: Union[Callable[[], float], 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, arg: object) -> None: ...
# ----- random function stubs -----
def seed(a: Any = None, version: int = 2) -> None: ...
def getstate() -> object: ...
def setstate(state: object) -> None: ...
def getrandbits(k: int) -> int: ...
def randrange(start: int, stop: Union[None, int] = None, step: int = 1) -> int: ...
def randint(a: int, b: int) -> int: ...
def choice(seq: Sequence[_T]) -> _T: ...
def shuffle(x: List[Any], random: Union[Callable[[], float], None] = 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: ...

58
stdlib/3/re.pyi Normal file
View File

@@ -0,0 +1,58 @@
# Stubs for re
# Ron Murawski <ron@horizonchess.com>
# 'bytes' support added by Jukka Lehtosalo
# based on: http://docs.python.org/3.2/library/re.html
# and http://hg.python.org/cpython/file/618ea5612e83/Lib/re.py
from typing import (
List, Iterator, Callable, Tuple, Sequence, Dict, Union,
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
U = 0
UNICODE = 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]]: ...
def sub(pattern: AnyStr, repl: Union[AnyStr, Callable[[Match[AnyStr]], AnyStr]],
string: AnyStr, count: int = 0, flags: int = 0) -> AnyStr: ...
def subn(pattern: AnyStr, repl: Union[AnyStr, Callable[[Match[AnyStr]], AnyStr]],
string: AnyStr, count: int = 0, flags: int = 0) -> Tuple[AnyStr, int]:
...
def escape(string: AnyStr) -> AnyStr: ...
def purge() -> None: ...

36
stdlib/3/shlex.pyi Normal file
View File

@@ -0,0 +1,36 @@
# Stubs for shlex
# Based on http://docs.python.org/3.2/library/shlex.html
from typing import List, Tuple, Any, TextIO
def split(s: str, comments: bool = False,
posix: bool = True) -> List[str]: ...
class shlex:
commenters = ''
wordchars = ''
whitespace = ''
escape = ''
quotes = ''
escapedquotes = ''
whitespace_split = ''
infile = ''
instream = ... # type: TextIO
source = ''
debug = 0
lineno = 0
token = ''
eof = ''
def __init__(self, instream=None, infile=None,
posix: bool = False) -> None: ...
def get_token(self) -> str: ...
def push_token(self, tok: str) -> None: ...
def read_token(self) -> str: ...
def sourcehook(self, filename: str) -> Tuple[str, TextIO]: ...
# TODO argument types
def push_source(self, newstream: Any, newfile: Any = None) -> None: ...
def pop_source(self) -> None: ...
def error_leader(self, infile: str = None,
lineno: int = None) -> None: ...

46
stdlib/3/shutil.pyi Normal file
View File

@@ -0,0 +1,46 @@
# Stubs for shutil
# Based on http://docs.python.org/3.2/library/shutil.html
# 'bytes' paths are not properly supported: they don't work with all functions,
# sometimes they only work partially (broken exception messages), and the test
# cases don't use them.
from typing import List, Iterable, Callable, Any, Tuple, Sequence, IO, AnyStr
def copyfileobj(fsrc: IO[AnyStr], fdst: IO[AnyStr],
length: int = None) -> None: ...
def copyfile(src: str, dst: str) -> None: ...
def copymode(src: str, dst: str) -> None: ...
def copystat(src: str, dst: str) -> None: ...
def copy(src: str, dst: str) -> None: ...
def copy2(src: str, dst: str) -> None: ...
def ignore_patterns(*patterns: str) -> Callable[[str, List[str]],
Iterable[str]]: ...
def copytree(src: str, dst: str, symlinks: bool = False,
ignore: Callable[[str, List[str]], Iterable[str]] = None,
copy_function: Callable[[str, str], None] = copy2,
ignore_dangling_symlinks: bool = False) -> None: ...
def rmtree(path: str, ignore_errors: bool = False,
onerror: Callable[[Any, str, Any], None] = None) -> None: ...
def move(src: str, dst: str) -> None: ...
class Error(Exception): ...
def make_archive(base_name: str, format: str, root_dir: str = None,
base_dir: str = None, verbose: bool = False,
dry_run: bool = False, owner: str = None, group: str = None,
logger: Any = None) -> str: ...
def get_archive_formats() -> List[Tuple[str, str]]: ...
def register_archive_format(name: str, function: Any,
extra_args: Sequence[Tuple[str, Any]] = None,
description: str = None) -> None: ...
def unregister_archive_format(name: str) -> None: ...
def unpack_archive(filename: str, extract_dir: str = None,
format: str = None) -> None: ...
def register_unpack_format(name: str, extensions: List[str], function: Any,
extra_args: Sequence[Tuple[str, Any]] = None,
description: str = None) -> None: ...
def unregister_unpack_format(name: str) -> None: ...
def get_unpack_formats() -> List[Tuple[str, List[str], str]]: ...

94
stdlib/3/smtplib.pyi Normal file
View File

@@ -0,0 +1,94 @@
# Stubs for smtplib (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class SMTPException(OSError): ...
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(addrstring): ...
def quotedata(data): ...
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
source_address = ... # type: Any
local_hostname = ... # type: Any
def __init__(self, host='', port=0, local_hostname=None, timeout=...,
source_address=None): ...
def __enter__(self): ...
def __exit__(self, *args): ...
def set_debuglevel(self, debuglevel): ...
sock = ... # type: Any
def connect(self, host='', port=0, source_address=None): ...
def send(self, s): ...
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, context=None): ...
def sendmail(self, from_addr, to_addrs, msg, mail_options=...,
rcpt_options=...): ...
def send_message(self, msg, from_addr=None, to_addrs=None, mail_options=...,
rcpt_options=...): ...
def close(self): ...
def quit(self): ...
class SMTP_SSL(SMTP):
default_port = ... # type: Any
keyfile = ... # type: Any
certfile = ... # type: Any
context = ... # type: Any
def __init__(self, host='', port=0, local_hostname=None, keyfile=None, certfile=None,
timeout=..., source_address=None, context=None): ...
class LMTP(SMTP):
ehlo_msg = ... # type: Any
def __init__(self, host='', port=..., local_hostname=None, source_address=None): ...
sock = ... # type: Any
file = ... # type: Any
def connect(self, host='', port=0, source_address=None): ...

387
stdlib/3/socket.pyi Normal file
View File

@@ -0,0 +1,387 @@
# 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
from typing import Any, Tuple, overload, List
# ----- 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) -> bytes: ...
@overload
def getsockopt(self, level: int, optname: str, buflen: int) -> bytes: ...
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) -> bytes: ...
# return type is an address
def recvfrom(self, bufsize: int, flags: int = 0) -> Any: ...
def recvfrom_into(self, buffer: bytes, nbytes: int,
flags: int = 0) -> Any: ...
def recv_into(self, buffer: bytes, nbytes: int,
flags: int = 0) -> Any: ...
def send(self, data: bytes, flags=0) -> int: ...
def sendall(self, data: bytes, flags=0) -> Any:
... # return type: None on success
@overload
def sendto(self, data: bytes, address: tuple, flags: int = 0) -> int: ...
@overload
def sendto(self, data: bytes, 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: bytes) -> 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: str, port: int, family: int = 0, type: int = 0, proto: int = 0,
flags: int = 0) -> List[Tuple[int, int, int, str, tuple]]:
...
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) -> bytes: ... # ret val 4 bytes in length
def inet_ntoa(packed_ip: bytes) -> str: ...
def inet_pton(address_family: int, ip_string: str) -> bytes: ...
def inet_ntop(address_family: int, packed_ip: bytes) -> str: ...
# TODO the timeout may be None
def getdefaulttimeout() -> float: ...
def setdefaulttimeout(timeout: float) -> None: ...

15
stdlib/3/socketserver.pyi Normal file
View File

@@ -0,0 +1,15 @@
# Stubs for socketserver
# NOTE: These are incomplete!
from typing import Tuple
class BaseRequestHandler(): ...
class TCPServer():
def __init__(
self,
server_address: Tuple[str, int],
request_handler: BaseRequestHandler,
bind_and_activate: bool = True,
) -> None: ...

202
stdlib/3/ssl.pyi Normal file
View File

@@ -0,0 +1,202 @@
# Stubs for ssl (Python 3.4)
from typing import Any
from enum import Enum as _Enum
from socket import socket
from collections import namedtuple
class SSLError(OSError): ...
class SSLEOFError(SSLError): ...
class SSLSyscallError(SSLError): ...
class SSLWantReadError(SSLError): ...
class SSLWantWriteError(SSLError): ...
class SSLZeroReturnError(SSLError): ...
OPENSSL_VERSION = ... # type: str
OPENSSL_VERSION_INFO = ... # type: Any
OPENSSL_VERSION_NUMBER = ... # type: int
VERIFY_CRL_CHECK_CHAIN = ... # type: int
VERIFY_CRL_CHECK_LEAF = ... # type: int
VERIFY_DEFAULT = ... # type: int
VERIFY_X509_STRICT = ... # type: int
ALERT_DESCRIPTION_ACCESS_DENIED = ... # type: int
ALERT_DESCRIPTION_BAD_CERTIFICATE = ... # type: int
ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE = ... # type: int
ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE = ... # type: int
ALERT_DESCRIPTION_BAD_RECORD_MAC = ... # type: int
ALERT_DESCRIPTION_CERTIFICATE_EXPIRED = ... # type: int
ALERT_DESCRIPTION_CERTIFICATE_REVOKED = ... # type: int
ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN = ... # type: int
ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE = ... # type: int
ALERT_DESCRIPTION_CLOSE_NOTIFY = ... # type: int
ALERT_DESCRIPTION_DECODE_ERROR = ... # type: int
ALERT_DESCRIPTION_DECOMPRESSION_FAILURE = ... # type: int
ALERT_DESCRIPTION_DECRYPT_ERROR = ... # type: int
ALERT_DESCRIPTION_HANDSHAKE_FAILURE = ... # type: int
ALERT_DESCRIPTION_ILLEGAL_PARAMETER = ... # type: int
ALERT_DESCRIPTION_INSUFFICIENT_SECURITY = ... # type: int
ALERT_DESCRIPTION_INTERNAL_ERROR = ... # type: int
ALERT_DESCRIPTION_NO_RENEGOTIATION = ... # type: int
ALERT_DESCRIPTION_PROTOCOL_VERSION = ... # type: int
ALERT_DESCRIPTION_RECORD_OVERFLOW = ... # type: int
ALERT_DESCRIPTION_UNEXPECTED_MESSAGE = ... # type: int
ALERT_DESCRIPTION_UNKNOWN_CA = ... # type: int
ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY = ... # type: int
ALERT_DESCRIPTION_UNRECOGNIZED_NAME = ... # type: int
ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE = ... # type: int
ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION = ... # type: int
ALERT_DESCRIPTION_USER_CANCELLED = ... # type: int
OP_ALL = ... # type: int
OP_CIPHER_SERVER_PREFERENCE = ... # type: int
OP_NO_COMPRESSION = ... # type: int
OP_NO_SSLv2 = ... # type: int
OP_NO_SSLv3 = ... # type: int
OP_NO_TLSv1 = ... # type: int
OP_NO_TLSv1_1 = ... # type: int
OP_NO_TLSv1_2 = ... # type: int
OP_SINGLE_DH_USE = ... # type: int
OP_SINGLE_ECDH_USE = ... # type: int
SSL_ERROR_EOF = ... # type: int
SSL_ERROR_INVALID_ERROR_CODE = ... # type: int
SSL_ERROR_SSL = ... # type: int
SSL_ERROR_SYSCALL = ... # type: int
SSL_ERROR_WANT_CONNECT = ... # type: int
SSL_ERROR_WANT_READ = ... # type: int
SSL_ERROR_WANT_WRITE = ... # type: int
SSL_ERROR_WANT_X509_LOOKUP = ... # type: int
SSL_ERROR_ZERO_RETURN = ... # type: int
CERT_NONE = ... # type: int
CERT_OPTIONAL = ... # type: int
CERT_REQUIRED = ... # type: int
PROTOCOL_SSLv23 = ... # type: int
PROTOCOL_SSLv3 = ... # type: int
PROTOCOL_TLSv1 = ... # type: int
PROTOCOL_TLSv1_1 = ... # type: int
PROTOCOL_TLSv1_2 = ... # type: int
HAS_ECDH = ... # type: bool
HAS_NPN = ... # type: bool
HAS_SNI = ... # type: bool
def RAND_add(string, entropy): ...
def RAND_bytes(n): ...
def RAND_egd(path): ...
def RAND_pseudo_bytes(n): ...
def RAND_status(): ...
socket_error = OSError
CHANNEL_BINDING_TYPES = ... # type: Any
class CertificateError(ValueError): ...
def match_hostname(cert, hostname): ...
DefaultVerifyPaths = namedtuple(
'DefaultVerifyPaths',
'cafile capath openssl_cafile_env openssl_cafile openssl_capath_env openssl_capath')
def get_default_verify_paths(): ...
class _ASN1Object:
def __new__(cls, oid): ...
@classmethod
def fromnid(cls, nid): ...
@classmethod
def fromname(cls, name): ...
class Purpose(_ASN1Object, _Enum):
SERVER_AUTH = ... # type: Any
CLIENT_AUTH = ... # type: Any
class _SSLContext:
check_hostname = ... # type: Any
options = ... # type: Any
verify_flags = ... # type: Any
verify_mode = ... # type: Any
def __init__(self, *args, **kwargs): ...
def _set_npn_protocols(self, *args, **kwargs): ...
def _wrap_socket(self, *args, **kwargs): ...
def cert_store_stats(self): ...
def get_ca_certs(self, binary_form=False): ...
def load_cert_chain(self, *args, **kwargs): ...
def load_dh_params(self, *args, **kwargs): ...
def load_verify_locations(self, *args, **kwargs): ...
def session_stats(self, *args, **kwargs): ...
def set_ciphers(self, *args, **kwargs): ...
def set_default_verify_paths(self, *args, **kwargs): ...
def set_ecdh_curve(self, *args, **kwargs): ...
def set_servername_callback(self, method): ...
class SSLContext(_SSLContext):
def __new__(cls, protocol, *args, **kwargs): ...
protocol = ... # type: Any
def __init__(self, protocol): ...
def wrap_socket(self, sock, server_side=False, do_handshake_on_connect=True,
suppress_ragged_eofs=True, server_hostname=None): ...
def set_npn_protocols(self, npn_protocols): ...
def load_default_certs(self, purpose=...): ...
def create_default_context(purpose=..., *, cafile=None, capath=None, cadata=None): ...
class SSLSocket(socket):
keyfile = ... # type: Any
certfile = ... # type: Any
cert_reqs = ... # type: Any
ssl_version = ... # type: Any
ca_certs = ... # type: Any
ciphers = ... # type: Any
server_side = ... # type: Any
server_hostname = ... # type: Any
do_handshake_on_connect = ... # type: Any
suppress_ragged_eofs = ... # type: Any
context = ... # type: Any # TODO: This should be a property.
def __init__(self, sock=None, keyfile=None, certfile=None, server_side=False,
cert_reqs=..., ssl_version=..., ca_certs=None,
do_handshake_on_connect=True, family=..., type=..., proto=0,
fileno=None, suppress_ragged_eofs=True, npn_protocols=None, ciphers=None,
server_hostname=None, _context=None): ...
def dup(self): ...
def read(self, len=0, buffer=None): ...
def write(self, data): ...
def getpeercert(self, binary_form=False): ...
def selected_npn_protocol(self): ...
def cipher(self): ...
def compression(self): ...
def send(self, data, flags=0): ...
def sendto(self, data, flags_or_addr, addr=None): ...
def sendmsg(self, *args, **kwargs): ...
def sendall(self, data, flags=0): ...
def recv(self, buflen=1024, flags=0): ...
def recv_into(self, buffer, nbytes=None, flags=0): ...
def recvfrom(self, buflen=1024, flags=0): ...
def recvfrom_into(self, buffer, nbytes=None, flags=0): ...
def recvmsg(self, *args, **kwargs): ...
def recvmsg_into(self, *args, **kwargs): ...
def pending(self): ...
def shutdown(self, how): ...
def unwrap(self): ...
def do_handshake(self, block=False): ...
def connect(self, addr): ...
def connect_ex(self, addr): ...
def accept(self): ...
def get_channel_binding(self, cb_type=''): ...
def wrap_socket(sock, keyfile=None, certfile=None, server_side=False, cert_reqs=...,
ssl_version=..., ca_certs=None, do_handshake_on_connect=True,
suppress_ragged_eofs=True, ciphers=None): ...
def cert_time_to_seconds(cert_time): ...
PEM_HEADER = ... # type: Any
PEM_FOOTER = ... # type: Any
def DER_cert_to_PEM_cert(der_cert_bytes): ...
def PEM_cert_to_DER_cert(pem_cert_string): ...
def get_server_certificate(addr, ssl_version=..., ca_certs=None): ...
def get_protocol_name(protocol_code): ...

71
stdlib/3/stat.pyi Normal file
View File

@@ -0,0 +1,71 @@
# Stubs for stat
# Based on http://docs.python.org/3.2/library/stat.html
import typing
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: ...
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
S_IFSOCK = 0
S_IFLNK = 0
S_IFREG = 0
S_IFBLK = 0
S_IFDIR = 0
S_IFCHR = 0
S_IFIFO = 0
S_ISUID = 0
S_ISGID = 0
S_ISVTX = 0
S_IRWXU = 0
S_IRUSR = 0
S_IWUSR = 0
S_IXUSR = 0
S_IRWXG = 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
#int UF_COMPRESSED # OS X 10.6+ only
#int UF_HIDDEN # OX X 10.5+ only
SF_ARCHIVED = 0
SF_IMMUTABLE = 0
SF_APPEND = 0
SF_NOUNLINK = 0
SF_SNAPSHOT = 0

27
stdlib/3/string.pyi Normal file
View File

@@ -0,0 +1,27 @@
# Stubs for string
# Based on http://docs.python.org/3.2/library/string.html
from typing import Mapping
ascii_letters = ''
ascii_lowercase = ''
ascii_uppercase = ''
digits = ''
hexdigits = ''
octdigits = ''
punctuation = ''
printable = ''
whitespace = ''
def capwords(s: str, sep: str = None) -> str: ...
class Template:
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 Formatter

Some files were not shown because too many files have changed in this diff Show More