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

34
builtins/2.7/_hotshot.pyi Normal file
View File

@@ -0,0 +1,34 @@
"""Stub file for the '_hotshot' module."""
# This is an autogenerated file. It serves as a starting point
# for a more precise manual annotation of this module.
# Feel free to edit the source below, but remove this header when you do.
from typing import Any, List, Tuple, Dict, Generic
def coverage(a: str) -> Any: ...
def logreader(a: str) -> LogReaderType:
raise IOError()
raise RuntimeError()
def profiler(a: str, *args, **kwargs) -> Any:
raise IOError()
def resolution() -> tuple: ...
class LogReaderType(object):
def close(self) -> None: ...
def fileno(self) -> int:
raise ValueError()
class ProfilerType(object):
def addinfo(self, a: str, b: str) -> None: ...
def close(self) -> None: ...
def fileno(self) -> int:
raise ValueError()
def runcall(self, *args, **kwargs) -> Any: ...
def runcode(self, a, b, *args, **kwargs) -> Any:
raise TypeError()
def start(self) -> None: ...
def stop(self) -> None: ...

19
builtins/2.7/_json.pyi Normal file
View File

@@ -0,0 +1,19 @@
"""Stub file for the '_json' module."""
# This is an autogenerated file. It serves as a starting point
# for a more precise manual annotation of this module.
# Feel free to edit the source below, but remove this header when you do.
from typing import Any, List, Tuple, Dict, Generic
def encode_basestring_ascii(*args, **kwargs) -> str:
raise TypeError()
def scanstring(a, b, *args, **kwargs) -> tuple:
raise TypeError()
class Encoder(object):
pass
class Scanner(object):
pass

View File

@@ -1,12 +1,12 @@
# Stubs for _random
from typing import Optional, Any
# NOTE: These are incomplete!
class Random(object):
def __init__(self, seed: x, object = None) -> None: ...
from typing import Any
class Random:
def seed(self, x: object = None) -> None: ...
def getstate(self) -> tuple: ...
def setstate(self, state: tuple) -> None: ...
def random(self) -> float: ...
def getrandbits(self, k: int) -> int: ...
def jumpahead(self, i: int) -> None: ...

View File

@@ -1,22 +1,20 @@
"""Stubs for the binascii module."""
# Stubs for binascii (Python 2)
from typing import Optional
def a2b_base64(string: str) -> str: ...
def a2b_hex(hexstr: str) -> str: ...
def a2b_hqx(string: str) -> str: ...
def a2b_qp(string: str, header: bool = None) -> str: ...
def a2b_uu(string: str) -> str: ...
def b2a_base64(data: str) -> str: ...
def b2a_hex(data: str) -> str: ...
def b2a_hqx(data: str) -> str: ...
def b2a_qp(data: str, quotetabs: bool = None, istext: bool = None, header: bool = None) -> str: ...
def b2a_uu(data: str) -> str: ...
def crc32(data: str, crc: Optional[int]) -> int: ...
def crc_hqx(data: str, oldcrc: int) -> int: ...
def hexlify(data: str) -> str: ...
def rlecode_hqx(data: str) -> str: ...
def a2b_base64(string: str) -> str: ...
def b2a_base64(data: str) -> str: ...
def a2b_qp(string: str, header: bool = None) -> str: ...
def b2a_qp(data: str, quotetabs: bool = None, istext: bool = None, header: bool = None) -> str: ...
def a2b_hqx(string: str) -> str: ...
def rledecode_hqx(data: str) -> str: ...
def rlecode_hqx(data: str) -> str: ...
def b2a_hqx(data: str) -> str: ...
def crc_hqx(data: str, crc: int) -> int: ...
def crc32(data: str, crc: int) -> int: ...
def b2a_hex(data: str) -> str: ...
def hexlify(data: str) -> str: ...
def a2b_hex(hexstr: str) -> str: ...
def unhexlify(hexstr: str) -> str: ...
class Error(Exception): ...

801
builtins/2.7/builtins.pyi Normal file
View File

@@ -0,0 +1,801 @@
# Stubs for builtins (Python 2.7)
from typing import (
TypeVar, Iterator, Iterable, overload,
Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set,
AbstractSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping,
MutableSet
)
from abc import abstractmethod, ABCMeta
_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() # Special, only valid as a decorator.
classmethod = object() # Special, 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__ = ''
__module__ = ''
__dict__ = ... # type: Dict[unicode, Any]
@overload
def __init__(self, o: object) -> None: ...
@overload
def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any]) -> None: ...
# TODO: __new__ may have to be special and not a static method.
@staticmethod
def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ...
class int(SupportsInt, SupportsFloat, SupportsAbs[int]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, x: SupportsInt) -> None: ...
@overload
def __init__(self, x: Union[str, unicode, bytearray], base: int = 10) -> None: ...
def bit_length(self) -> int: ...
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 __div__(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 __rdiv__(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]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, x: SupportsFloat) -> None: ...
@overload
def __init__(self, x: unicode) -> None: ...
@overload
def __init__(self, x: bytearray) -> 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 __div__(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 __rdiv__(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: return self
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 __div__(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 __rdiv__(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 basestring(metaclass=ABCMeta): ...
class unicode(basestring, Sequence[unicode]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, o: object) -> None: ...
@overload
def __init__(self, o: str, encoding: unicode = ..., errors: unicode = 'strict') -> None: ...
def capitalize(self) -> unicode: ...
def center(self, width: int, fillchar: unicode = u' ') -> unicode: ...
def count(self, x: unicode) -> int: ...
def decode(self, encoding: unicode = 'utf-8', errors: unicode = 'strict') -> unicode: ...
def encode(self, encoding: unicode = 'utf-8', errors: unicode = 'strict') -> str: ...
def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]], start: int = 0,
end: int = ...) -> bool: ...
def expandtabs(self, tabsize: int = 8) -> unicode: ...
def find(self, sub: unicode, start: int = 0, end: int = 0) -> int: ...
def format(self, *args: Any, **kwargs: Any) -> unicode: ...
def format_map(self, map: Mapping[unicode, Any]) -> unicode: ...
def index(self, sub: unicode, 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[unicode]) -> unicode: ...
def ljust(self, width: int, fillchar: unicode = u' ') -> unicode: ...
def lower(self) -> unicode: ...
def lstrip(self, chars: unicode = ...) -> unicode: ...
def partition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
def replace(self, old: unicode, new: unicode, count: int = ...) -> unicode: ...
def rfind(self, sub: unicode, start: int = 0, end: int = 0) -> int: ...
def rindex(self, sub: unicode, start: int = 0, end: int = 0) -> int: ...
def rjust(self, width: int, fillchar: unicode = u' ') -> unicode: ...
def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
def rsplit(self, sep: unicode = ..., maxsplit: int = ...) -> List[unicode]: ...
def rstrip(self, chars: unicode = ...) -> unicode: ...
def split(self, sep: unicode = ..., maxsplit: int = ...) -> List[unicode]: ...
def splitlines(self, keepends: bool = False) -> List[unicode]: ...
def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]], start: int = 0,
end: int = ...) -> bool: ...
def strip(self, chars: unicode = ...) -> unicode: ...
def swapcase(self) -> unicode: ...
def title(self) -> unicode: ...
def translate(self, table: Union[Dict[int, Any], unicode]) -> unicode: ...
def upper(self) -> unicode: ...
def zfill(self, width: int) -> unicode: ...
@overload
def __getitem__(self, i: int) -> unicode: ...
@overload
def __getitem__(self, s: slice) -> unicode: ...
def __getslice__(self, start: int, stop: int) -> unicode: ...
def __add__(self, s: unicode) -> unicode: ...
def __mul__(self, n: int) -> unicode: ...
def __mod__(self, x: Any) -> unicode: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: unicode) -> bool: ...
def __le__(self, x: unicode) -> bool: ...
def __gt__(self, x: unicode) -> bool: ...
def __ge__(self, x: unicode) -> bool: ...
def __len__(self) -> int: ...
def __contains__(self, s: object) -> bool: ...
def __iter__(self) -> Iterator[unicode]: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
class str(basestring, Sequence[str]):
def __init__(self, object: object) -> None: ...
def capitalize(self) -> str: ...
def center(self, width: int, fillchar: str = ...) -> str: ...
def count(self, x: unicode) -> int: ...
def decode(self, encoding: unicode = 'utf-8', errors: unicode = 'strict') -> unicode: ...
def encode(self, encoding: unicode = 'utf-8', errors: unicode = 'strict') -> str: ...
def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]]) -> bool: ...
def expandtabs(self, tabsize: int = 8) -> str: ...
def find(self, sub: unicode, start: int = 0, end: int = 0) -> int: ...
def format(self, *args: Any, **kwargs: Any) -> str: ...
def index(self, sub: unicode, 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[AnyStr]) -> AnyStr: ...
def ljust(self, width: int, fillchar: str = ...) -> str: ...
def lower(self) -> str: ...
@overload
def lstrip(self, chars: str = ...) -> str: ...
@overload
def lstrip(self, chars: unicode) -> unicode: ...
@overload
def partition(self, sep: bytearray) -> Tuple[str, bytearray, str]: ...
@overload
def partition(self, sep: str) -> Tuple[str, str, str]: ...
@overload
def partition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
def replace(self, old: AnyStr, new: AnyStr, count: int = ...) -> AnyStr: ...
def rfind(self, sub: unicode, start: int = 0, end: int = 0) -> int: ...
def rindex(self, sub: unicode, start: int = 0, end: int = 0) -> int: ...
def rjust(self, width: int, fillchar: str = ...) -> str: ...
@overload
def rpartition(self, sep: bytearray) -> Tuple[str, bytearray, str]: ...
@overload
def rpartition(self, sep: str) -> Tuple[str, str, str]: ...
@overload
def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
@overload
def rsplit(self, sep: str = ..., maxsplit: int = ...) -> List[str]: ...
@overload
def rsplit(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
@overload
def rstrip(self, chars: str = ...) -> str: ...
@overload
def rstrip(self, chars: unicode) -> unicode: ...
@overload
def split(self, sep: str = ..., maxsplit: int = ...) -> List[str]: ...
@overload
def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
def splitlines(self, keepends: bool = False) -> List[str]: ...
def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]]) -> bool: ...
@overload
def strip(self, chars: str = ...) -> str: ...
@overload
def strip(self, chars: unicode) -> unicode: ...
def swapcase(self) -> str: ...
def title(self) -> str: ...
def translate(self, table: AnyStr, deletechars: AnyStr = None) -> AnyStr: ...
def upper(self) -> str: ...
def zfill(self, width: int) -> str: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[str]: ...
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) -> str: ...
@overload
def __getitem__(self, s: slice) -> str: ...
def __getslice__(self, start: int, stop: int) -> str: ...
def __add__(self, s: AnyStr) -> AnyStr: ...
def __mul__(self, n: int) -> str: ...
def __rmul__(self, n: int) -> str: ...
def __contains__(self, o: object) -> bool: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: unicode) -> bool: ...
def __le__(self, x: unicode) -> bool: ...
def __gt__(self, x: unicode) -> bool: ...
def __ge__(self, x: unicode) -> bool: ...
def __mod__(self, x: Any) -> str: ...
class bytearray(Sequence[int]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, x: Union[Iterable[int], str]) -> None: ...
@overload
def __init__(self, x: unicode, encoding: unicode,
errors: unicode = 'strict') -> None: ...
@overload
def __init__(self, length: int) -> None: ...
def capitalize(self) -> bytearray: ...
def center(self, width: int, fillchar: str = ...) -> bytearray: ...
def count(self, x: str) -> int: ...
def decode(self, encoding: unicode = 'utf-8', errors: unicode = 'strict') -> str: ...
def endswith(self, suffix: Union[str, Tuple[str, ...]]) -> bool: ...
def expandtabs(self, tabsize: int = 8) -> bytearray: ...
def find(self, sub: str, start: int = 0, end: int = ...) -> int: ...
def index(self, sub: str, start: int = 0, end: int = ...) -> 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[str]) -> bytearray: ...
def ljust(self, width: int, fillchar: str = ...) -> bytearray: ...
def lower(self) -> bytearray: ...
def lstrip(self, chars: str = ...) -> bytearray: ...
def partition(self, sep: str) -> Tuple[bytearray, bytearray, bytearray]: ...
def replace(self, old: str, new: str, count: int = ...) -> bytearray: ...
def rfind(self, sub: str, start: int = 0, end: int = ...) -> int: ...
def rindex(self, sub: str, start: int = 0, end: int = ...) -> int: ...
def rjust(self, width: int, fillchar: str = ...) -> bytearray: ...
def rpartition(self, sep: str) -> Tuple[bytearray, bytearray, bytearray]: ...
def rsplit(self, sep: str = ..., maxsplit: int = ...) -> List[bytearray]: ...
def rstrip(self, chars: str = ...) -> bytearray: ...
def split(self, sep: str = ..., maxsplit: int = ...) -> List[bytearray]: ...
def splitlines(self, keepends: bool = False) -> List[bytearray]: ...
def startswith(self, prefix: Union[str, Tuple[str, ...]]) -> bool: ...
def strip(self, chars: str = ...) -> bytearray: ...
def swapcase(self) -> bytearray: ...
def title(self) -> bytearray: ...
def translate(self, table: str) -> bytearray: ...
def upper(self) -> bytearray: ...
def zfill(self, width: int) -> bytearray: ...
@staticmethod
def fromhex(self, x: str) -> bytearray: ...
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: ...
def __getslice__(self, start: int, stop: int) -> bytearray: ...
@overload
def __setitem__(self, i: int, x: int) -> None: ...
@overload
def __setitem__(self, s: slice, x: Union[Sequence[int], str]) -> None: ...
def __setslice__(self, start: int, stop: int, x: Union[Sequence[int], str]) -> None: ...
@overload
def __delitem__(self, i: int) -> None: ...
@overload
def __delitem__(self, s: slice) -> None: ...
def __delslice__(self, start: int, stop: int) -> None: ...
def __add__(self, s: str) -> bytearray: ...
def __mul__(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: str) -> bool: ...
def __le__(self, x: str) -> bool: ...
def __gt__(self, x: str) -> bool: ...
def __ge__(self, x: str) -> bool: ...
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, step: int) -> 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 name of the class (corresponds to Python 'function' class)
__name__ = ''
__module__ = ''
class list(MutableSequence[_T], Reversible[_T], Generic[_T]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T]) -> None: ...
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] = ..., 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]: ...
def __getslice__(self, start: int, stop: int) -> List[_T]: ...
@overload
def __setitem__(self, i: int, o: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: Sequence[_T]) -> None: ...
def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __delslice(self, start: int, stop: int) -> None: ...
def __add__(self, x: List[_T]) -> List[_T]: ...
def __mul__(self, n: int) -> List[_T]: ...
def __rmul__(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 has_key(self, k: _KT) -> bool: ...
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 = ...) -> _VT: ...
def popitem(self) -> Tuple[_KT, _VT]: ...
def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
def update(self, m: Union[Mapping[_KT, _VT],
Iterable[Tuple[_KT, _VT]]]) -> None: ...
def keys(self) -> List[_KT]: ...
def values(self) -> List[_VT]: ...
def items(self) -> List[Tuple[_KT, _VT]]: ...
def iterkeys(self) -> Iterator[_KT]: ...
def itervalues(self) -> Iterator[_VT]: ...
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
def __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]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T]) -> None: ...
def add(self, element: _T) -> None: ...
def remove(self, element: _T) -> None: ...
def copy(self) -> AbstractSet[_T]: ...
def isdisjoint(self, s: AbstractSet[_T]) -> bool: ...
def issuperset(self, s: AbstractSet[_T]) -> bool: ...
def issubset(self, s: AbstractSet[_T]) -> bool: ...
def update(self, s: AbstractSet[_T]) -> None: ...
def difference_update(self, s: AbstractSet[_T]) -> None: ...
def intersection_update(self, s: AbstractSet[_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[_T]) -> AbstractSet[_T]: ...
def __or__(self, s: AbstractSet[_S]) -> AbstractSet[Union[_T, _S]]: ...
def __sub__(self, s: AbstractSet[_T]) -> AbstractSet[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> AbstractSet[Union[_T, _S]]: ...
# TODO more set operations
class frozenset(AbstractSet[_T], Generic[_T]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T]) -> None: ...
def isdisjoint(self, s: AbstractSet[_T]) -> bool: ...
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]]: ...
# TODO more set operations
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 xrange(Sized, Iterable[int], Reversible[int]):
@overload
def __init__(self, stop: int) -> None: ...
@overload
def __init__(self, start: int, stop: int, step: int = 1) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[int]: ...
def __getitem__(self, i: int) -> int: ...
def __reversed__(self) -> Iterator[int]: ...
class module:
__name__ = ''
__file__ = ''
__dict__ = ... # type: Dict[unicode, Any]
True = ... # type: bool
False = ... # type: bool
__debug__ = False
long = int
bytes = str
NotImplemented = ... # type: Any
def abs(n: SupportsAbs[_T]) -> _T: ...
def all(i: Iterable) -> bool: ...
def any(i: Iterable) -> bool: ...
def bin(number: int) -> str: ...
def callable(o: object) -> bool: ...
def chr(code: int) -> str: ...
def delattr(o: Any, name: unicode) -> None: ...
def dir(o: object = ...) -> List[str]: ...
@overload
def divmod(a: int, b: int) -> Tuple[int, int]: ...
@overload
def divmod(a: float, b: float) -> Tuple[float, float]: ...
def exit(code: int = ...) -> None: ...
def filter(function: Callable[[_T], Any],
iterable: Iterable[_T]) -> List[_T]: ...
def format(o: object, format_spec: str = '') -> str: ... # TODO unicode
def getattr(o: Any, name: unicode, default: Any = None) -> Any: ...
def hasattr(o: Any, name: unicode) -> bool: ...
def hash(o: object) -> int: ...
def hex(i: int) -> str: ... # TODO __index__
def id(o: object) -> int: ...
def input(prompt: unicode = ...) -> Any: ...
def intern(string: str) -> 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: Sized) -> int: ...
@overload
def map(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> List[_S]: ...
@overload
def map(func: Callable[[_T1, _T2], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> List[_S]: ... # TODO more than two iterables
@overload
def max(iterable: Iterable[_T], key: Callable[[_T], Any] = None) -> _T: ...
@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__
@overload
def open(file: str, mode: str = 'r', buffering: int = ...) -> BinaryIO: ...
@overload
def open(file: unicode, mode: str = 'r', buffering: int = ...) -> BinaryIO: ...
@overload
def open(file: int, mode: str = 'r', buffering: int = ...) -> BinaryIO: ...
def ord(c: unicode) -> int: ...
# This is only available after from __future__ import print_function.
def print(*values: Any, sep: unicode = u' ', end: unicode = u'\n',
file: IO[Any] = ...) -> 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: ...
def range(x: int, y: int = 0, step: int = 1) -> List[int]: ...
def raw_input(prompt: unicode = ...) -> str: ...
def reduce(function: Callable[[_T, _T], _T], iterable: Iterable[_T], initializer: _T = None) -> _T: ...
def reload(module: Any) -> Any: ...
@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: unicode, value: Any) -> None: ...
def sorted(iterable: Iterable[_T], *,
cmp: Callable[[_T, _T], int] = ...,
key: Callable[[_T], Any] = ...,
reverse: bool = False) -> List[_T]: ...
def sum(iterable: Iterable[_T], start: _T = ...) -> _T: ...
def unichr(i: int) -> unicode: ...
def vars(object: Any = ...) -> Dict[str, Any]: ...
@overload
def zip(iter1: Iterable[_T1]) -> List[Tuple[_T1]]: ...
@overload
def zip(iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2,
_T3, _T4]]: ... # TODO more than four iterables
def __import__(name: unicode,
globals: Dict[str, Any] = ...,
locals: Dict[str, Any] = ...,
fromlist: List[str] = ..., level: int = ...) -> Any: ...
def globals() -> Dict[str, Any]: ...
def locals() -> Dict[str, Any]: ...
# TODO: buffer support is incomplete; e.g. some_string.startswith(some_buffer) doesn't type check.
AnyBuffer = TypeVar('AnyBuffer', str, unicode, bytearray, buffer)
class buffer(Sized):
def __init__(self, object: AnyBuffer, offset: int = ..., size: int = ...) -> None: ...
def __add__(self, other: AnyBuffer) -> str: ...
def __cmp__(self, other: AnyBuffer) -> bool: ...
def __getitem__(self, key: Union[int, slice]) -> str: ...
def __getslice__(self, i: int, j: int) -> str: ...
def __len__(self) -> int: ...
def __mul__(self, x: int) -> str: ...
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 StopIteration(Exception): ...
class StandardError(Exception): ...
class ArithmeticError(StandardError): ...
class EnvironmentError(StandardError):
errno = 0
strerror = ''
filename = '' # TODO can this be unicode?
class LookupError(StandardError): ...
class RuntimeError(StandardError): ...
class ValueError(StandardError): ...
class AssertionError(StandardError): ...
class AttributeError(StandardError): ...
class EOFError(StandardError): ...
class FloatingPointError(ArithmeticError): ...
class IOError(EnvironmentError): ...
class ImportError(StandardError): ...
class IndexError(LookupError): ...
class KeyError(LookupError): ...
class MemoryError(StandardError): ...
class NameError(StandardError): ...
class NotImplementedError(RuntimeError): ...
class OSError(EnvironmentError): ...
class WindowsError(OSError): ...
class OverflowError(ArithmeticError): ...
class ReferenceError(StandardError): ...
class SyntaxError(StandardError): ...
class IndentationError(SyntaxError): ...
class TabError(IndentationError): ...
class SystemError(StandardError): ...
class TypeError(StandardError): ...
class UnboundLocalError(NameError): ...
class UnicodeError(ValueError): ...
class UnicodeDecodeError(UnicodeError): ...
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): ...
def eval(s: str) -> Any: ...
def cmp(x: Any, y: Any) -> int: ...
def execfile(filename: str, globals: Dict[str, Any] = None, locals: Dict[str, Any] = None) -> None: ...

View File

@@ -1,7 +1,10 @@
# Stubs for cStringIO (Python 2.7)
# See https://docs.python.org/2/library/stringio.html
# Built from https://docs.python.org/2/library/stringio.html
from typing import IO, List, Iterable, Iterator, Any, Union
from typing import IO, List, Iterable, Iterator, Any
InputType = ... # type: type
OutputType = ... # type: type
class StringIO(IO[str]):
softspace = ... # type: int
@@ -15,25 +18,17 @@ class StringIO(IO[str]):
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, size: int = -1) -> str: ...
def write(self, b: str) -> None: ...
def readable(self) -> bool: ...
def readline(self, size: int = -1) -> str: ...
def readlines(self, hint: int = -1) -> List[str]: ...
def seek(self, offset: int, whence: int = ...) -> None: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: int = None) -> int:
raise IOError()
def truncate(self, size: int = None) -> int: ...
def writable(self) -> bool: ...
def writelines(self, lines: Iterable[str]) -> None: ...
def next(self) -> str: ...
def __iter__(self) -> "InputType": ...
def __iter__(self) -> Iterator[str]: ...
def __enter__(self) -> Any: ...
def __exit__(self, exc_type: type, exc_val: Any, exc_tb: Any) -> Any: ...
# only StringO:
def reset() -> None: ...
def write(self, b: Union[str, unicode]) -> None: ...
def writelines(self, lines: Iterable[Union[str, unicode]]) -> None: ...
InputType = StringIO
OutputType = StringIO

220
builtins/2.7/datetime.pyi Normal file
View File

@@ -0,0 +1,220 @@
# Stubs for datetime
# NOTE: These are incomplete!
from typing import Optional, SupportsAbs, Tuple, Union, overload
MINYEAR = 0
MAXYEAR = 0
class tzinfo(object):
def tzname(self, dt: Optional[datetime]) -> str: ...
def utcoffset(self, dt: Optional[datetime]) -> int: ...
def dst(self, dt: Optional[datetime]) -> int: ...
def fromutc(self, dt: datetime) -> datetime: ...
class timezone(tzinfo):
utc = ... # type: tzinfo
min = ... # type: tzinfo
max = ... # type: tzinfo
def __init__(self, offset: timedelta, name: str = '') -> None: ...
def __hash__(self) -> int: ...
_tzinfo = tzinfo
_timezone = timezone
class date(object):
min = ... # type: date
max = ... # type: date
resolution = ... # type: timedelta
def __init__(self, year: int, month: int = None, day: int = None) -> None: ...
@classmethod
def fromtimestamp(cls, t: float) -> date: ...
@classmethod
def today(cls) -> date: ...
@classmethod
def fromordinal(cls, n: int) -> date: ...
@property
def year(self) -> int: ...
@property
def month(self) -> int: ...
@property
def day(self) -> int: ...
def ctime(self) -> str: ...
def strftime(self, fmt: str) -> str: ...
def __format__(self, fmt: str) -> str: ...
def isoformat(self) -> str: ...
def timetuple(self) -> tuple: ... # TODO return type
def toordinal(self) -> int: ...
def replace(self, year: int = None, month: int = None, day: int = None) -> date: ...
def __le__(self, other: date) -> bool: ...
def __lt__(self, other: date) -> bool: ...
def __ge__(self, other: date) -> bool: ...
def __gt__(self, other: date) -> bool: ...
def __add__(self, other: timedelta) -> date: ...
@overload
def __sub__(self, other: timedelta) -> date: ...
@overload
def __sub__(self, other: date) -> timedelta: ...
def __hash__(self) -> int: ...
def weekday(self) -> int: ...
def isoweekday(self) -> int: ...
def isocalendar(self) -> Tuple[int, int, int]: ...
class time:
min = ... # type: time
max = ... # type: time
resolution = ... # type: timedelta
def __init__(self, hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0,
tzinfo: tzinfo = None) -> None: ...
@property
def hour(self) -> int: ...
@property
def minute(self) -> int: ...
@property
def second(self) -> int: ...
@property
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> _tzinfo: ...
def __le__(self, other: time) -> bool: ...
def __lt__(self, other: time) -> bool: ...
def __ge__(self, other: time) -> bool: ...
def __gt__(self, other: time) -> bool: ...
def __hash__(self) -> int: ...
def isoformat(self) -> str: ...
def strftime(self, fmt: str) -> str: ...
def __format__(self, fmt: str) -> str: ...
def utcoffset(self) -> Optional[int]: ...
def tzname(self) -> Optional[str]: ...
def dst(self) -> Optional[int]: ...
def replace(self, hour: int = None, minute: int = None, second: int = None,
microsecond: int = None, tzinfo: Union[_tzinfo, bool] = True) -> time: ...
_date = date
_time = time
class timedelta(SupportsAbs[timedelta]):
min = ... # type: timedelta
max = ... # type: timedelta
resolution = ... # type: timedelta
def __init__(self, days: int = 0, seconds: int = 0, microseconds: int = 0,
milliseconds: int = 0, minutes: int = 0, hours: int = 0,
weeks: int = 0) -> None: ...
@property
def days(self) -> int: ...
@property
def seconds(self) -> int: ...
@property
def microseconds(self) -> int: ...
def total_seconds(self) -> float: ...
def __add__(self, other: timedelta) -> timedelta: ...
def __radd__(self, other: timedelta) -> timedelta: ...
def __sub__(self, other: timedelta) -> timedelta: ...
def __rsub(self, other: timedelta) -> timedelta: ...
def __neg__(self) -> timedelta: ...
def __pos__(self) -> timedelta: ...
def __abs__(self) -> timedelta: ...
def __mul__(self, other: float) -> timedelta: ...
def __rmul__(self, other: float) -> timedelta: ...
@overload
def __floordiv__(self, other: timedelta) -> int: ...
@overload
def __floordiv__(self, other: int) -> timedelta: ...
@overload
def __truediv__(self, other: timedelta) -> float: ...
@overload
def __truediv__(self, other: float) -> timedelta: ...
def __mod__(self, other: timedelta) -> timedelta: ...
def __divmod__(self, other: timedelta) -> Tuple[int, timedelta]: ...
def __le__(self, other: timedelta) -> bool: ...
def __lt__(self, other: timedelta) -> bool: ...
def __ge__(self, other: timedelta) -> bool: ...
def __gt__(self, other: timedelta) -> bool: ...
def __hash__(self) -> int: ...
class datetime(object):
# TODO: is actually subclass of date, but __le__, __lt__, __ge__, __gt__ don't work with date.
min = ... # type: datetime
max = ... # type: datetime
resolution = ... # type: timedelta
def __init__(self, year: int, month: int = None, day: int = None, hour: int = None,
minute: int = None, second: int = None, microseconds: int = None,
tzinfo: tzinfo = None) -> None: ...
@property
def year(self) -> int: ...
@property
def month(self) -> int: ...
@property
def day(self) -> int: ...
@property
def hour(self) -> int: ...
@property
def minute(self) -> int: ...
@property
def second(self) -> int: ...
@property
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> _tzinfo: ...
@classmethod
def fromtimestamp(cls, t: float, tz: timezone = None) -> datetime: ...
@classmethod
def utcfromtimestamp(cls, t: float) -> datetime: ...
@classmethod
def today(cls) -> datetime: ...
@classmethod
def fromordinal(cls, n: int) -> datetime: ...
@classmethod
def now(cls, tz: timezone = None) -> datetime: ...
@classmethod
def utcnow(cls) -> datetime: ...
@classmethod
def combine(cls, date: date, time: time) -> datetime: ...
def strftime(self, fmt: str) -> str: ...
def __format__(self, fmt: str) -> str: ...
def toordinal(self) -> int: ...
def timetuple(self) -> tuple: ... # TODO return type
def timestamp(self) -> float: ...
def utctimetuple(self) -> tuple: ... # TODO return type
def date(self) -> _date: ...
def time(self) -> _time: ...
def timetz(self) -> _time: ...
def replace(self, year: int = None, month: int = None, day: int = None, hour: int = None,
minute: int = None, second: int = None, microsecond: int = None, tzinfo:
Union[_tzinfo, bool] = True) -> datetime: ...
def astimezone(self, tz: timezone = None) -> datetime: ...
def ctime(self) -> str: ...
def isoformat(self, sep: str = 'T') -> str: ...
@classmethod
def strptime(cls, date_string: str, format: str) -> datetime: ...
def utcoffset(self) -> Optional[int]: ...
def tzname(self) -> Optional[str]: ...
def dst(self) -> Optional[int]: ...
def __le__(self, other: datetime) -> bool: ...
def __lt__(self, other: datetime) -> bool: ...
def __ge__(self, other: datetime) -> bool: ...
def __gt__(self, other: datetime) -> bool: ...
def __add__(self, other: timedelta) -> datetime: ...
@overload
def __sub__(self, other: datetime) -> timedelta: ...
@overload
def __sub__(self, other: timedelta) -> datetime: ...
def __hash__(self) -> int: ...
def weekday(self) -> int: ...
def isoweekday(self) -> int: ...
def isocalendar(self) -> Tuple[int, int, int]: ...

View File

@@ -1,129 +1,126 @@
"""Stubs for the 'errno' module."""
from typing import Mapping
from typing import Dict
errorcode = ... # type: Mapping[int, str]
errorcode = ... # type: Dict[int, str]
E2BIG = ... # type: int
EACCES = ... # type: int
EADDRINUSE = ... # type: int
EADDRNOTAVAIL = ... # type: int
EADV = ... # type: int
EAFNOSUPPORT = ... # type: int
EAGAIN = ... # type: int
EALREADY = ... # type: int
EBADE = ... # type: int
EBADF = ... # type: int
EBADFD = ... # type: int
EBADMSG = ... # type: int
EBADR = ... # type: int
EBADRQC = ... # type: int
EBADSLT = ... # type: int
EBFONT = ... # type: int
EBUSY = ... # type: int
ECHILD = ... # type: int
ECHRNG = ... # type: int
ECOMM = ... # type: int
ECONNABORTED = ... # type: int
ECONNREFUSED = ... # type: int
ECONNRESET = ... # type: int
EDEADLK = ... # type: int
EDEADLOCK = ... # type: int
EDESTADDRREQ = ... # type: int
EDOM = ... # type: int
EDOTDOT = ... # type: int
EDQUOT = ... # type: int
EEXIST = ... # type: int
EFAULT = ... # type: int
EFBIG = ... # type: int
EHOSTDOWN = ... # type: int
EHOSTUNREACH = ... # type: int
EIDRM = ... # type: int
EILSEQ = ... # type: int
EINPROGRESS = ... # type: int
EINTR = ... # type: int
EINVAL = ... # type: int
EIO = ... # type: int
EISCONN = ... # type: int
EISDIR = ... # type: int
EISNAM = ... # type: int
EL2HLT = ... # type: int
EL2NSYNC = ... # type: int
EL3HLT = ... # type: int
EL3RST = ... # type: int
ELIBACC = ... # type: int
ELIBBAD = ... # type: int
ELIBEXEC = ... # type: int
ELIBMAX = ... # type: int
ELIBSCN = ... # type: int
ELNRNG = ... # type: int
ELOOP = ... # type: int
EMFILE = ... # type: int
EMLINK = ... # type: int
EMSGSIZE = ... # type: int
EMULTIHOP = ... # type: int
ENAMETOOLONG = ... # type: int
ENAVAIL = ... # type: int
ENETDOWN = ... # type: int
ENETRESET = ... # type: int
ENETUNREACH = ... # type: int
ENFILE = ... # type: int
ENOANO = ... # type: int
ENOBUFS = ... # type: int
ENOCSI = ... # type: int
ENODATA = ... # type: int
ENODEV = ... # type: int
ENOENT = ... # type: int
ENOEXEC = ... # type: int
ENOLCK = ... # type: int
ENOLINK = ... # type: int
ENOMEM = ... # type: int
ENOMSG = ... # type: int
ENONET = ... # type: int
ENOPKG = ... # type: int
ENOPROTOOPT = ... # type: int
ENOSPC = ... # type: int
ENOSR = ... # type: int
ENOSTR = ... # type: int
ENOSYS = ... # type: int
ENOTBLK = ... # type: int
ENOTCONN = ... # type: int
ENOTDIR = ... # type: int
ENOTEMPTY = ... # type: int
ENOTNAM = ... # type: int
ENOTSOCK = ... # type: int
ENOTSUP = ... # type: int
ENOTTY = ... # type: int
ENOTUNIQ = ... # type: int
ENXIO = ... # type: int
EOPNOTSUPP = ... # type: int
EOVERFLOW = ... # type: int
EPERM = ... # type: int
EPFNOSUPPORT = ... # type: int
EPIPE = ... # type: int
EPROTO = ... # type: int
EPROTONOSUPPORT = ... # type: int
EPROTOTYPE = ... # type: int
ERANGE = ... # type: int
EREMCHG = ... # type: int
EREMOTE = ... # type: int
EREMOTEIO = ... # type: int
ERESTART = ... # type: int
EROFS = ... # type: int
ESHUTDOWN = ... # type: int
ESOCKTNOSUPPORT = ... # type: int
ESPIPE = ... # type: int
ESRCH = ... # type: int
ESRMNT = ... # type: int
ESTALE = ... # type: int
ESTRPIPE = ... # type: int
ETIME = ... # type: int
ETIMEDOUT = ... # type: int
ETOOMANYREFS = ... # type: int
ETXTBSY = ... # type: int
EUCLEAN = ... # type: int
EUNATCH = ... # type: int
EUSERS = ... # type: int
EWOULDBLOCK = ... # type: int
EXDEV = ... # type: int
EXFULL = ... # type: int
EPERM = ... # type: int
ENOENT = ... # type: int
ESRCH = ... # type: int
EINTR = ... # type: int
EIO = ... # type: int
ENXIO = ... # type: int
E2BIG = ... # type: int
ENOEXEC = ... # type: int
EBADF = ... # type: int
ECHILD = ... # type: int
EAGAIN = ... # type: int
ENOMEM = ... # type: int
EACCES = ... # type: int
EFAULT = ... # type: int
ENOTBLK = ... # type: int
EBUSY = ... # type: int
EEXIST = ... # type: int
EXDEV = ... # type: int
ENODEV = ... # type: int
ENOTDIR = ... # type: int
EISDIR = ... # type: int
EINVAL = ... # type: int
ENFILE = ... # type: int
EMFILE = ... # type: int
ENOTTY = ... # type: int
ETXTBSY = ... # type: int
EFBIG = ... # type: int
ENOSPC = ... # type: int
ESPIPE = ... # type: int
EROFS = ... # type: int
EMLINK = ... # type: int
EPIPE = ... # type: int
EDOM = ... # type: int
ERANGE = ... # type: int
EDEADLK = ... # type: int
ENAMETOOLONG = ... # type: int
ENOLCK = ... # type: int
ENOSYS = ... # type: int
ENOTEMPTY = ... # type: int
ELOOP = ... # type: int
EWOULDBLOCK = ... # type: int
ENOMSG = ... # type: int
EIDRM = ... # type: int
ECHRNG = ... # type: int
EL2NSYNC = ... # type: int
EL3HLT = ... # type: int
EL3RST = ... # type: int
ELNRNG = ... # type: int
EUNATCH = ... # type: int
ENOCSI = ... # type: int
EL2HLT = ... # type: int
EBADE = ... # type: int
EBADR = ... # type: int
EXFULL = ... # type: int
ENOANO = ... # type: int
EBADRQC = ... # type: int
EBADSLT = ... # type: int
EDEADLOCK = ... # type: int
EBFONT = ... # type: int
ENOSTR = ... # type: int
ENODATA = ... # type: int
ETIME = ... # type: int
ENOSR = ... # type: int
ENONET = ... # type: int
ENOPKG = ... # type: int
EREMOTE = ... # type: int
ENOLINK = ... # type: int
EADV = ... # type: int
ESRMNT = ... # type: int
ECOMM = ... # type: int
EPROTO = ... # type: int
EMULTIHOP = ... # type: int
EDOTDOT = ... # type: int
EBADMSG = ... # type: int
EOVERFLOW = ... # type: int
ENOTUNIQ = ... # type: int
EBADFD = ... # type: int
EREMCHG = ... # type: int
ELIBACC = ... # type: int
ELIBBAD = ... # type: int
ELIBSCN = ... # type: int
ELIBMAX = ... # type: int
ELIBEXEC = ... # type: int
EILSEQ = ... # type: int
ERESTART = ... # type: int
ESTRPIPE = ... # type: int
EUSERS = ... # type: int
ENOTSOCK = ... # type: int
EDESTADDRREQ = ... # type: int
EMSGSIZE = ... # type: int
EPROTOTYPE = ... # type: int
ENOPROTOOPT = ... # type: int
EPROTONOSUPPORT = ... # type: int
ESOCKTNOSUPPORT = ... # type: int
EOPNOTSUPP = ... # type: int
EPFNOSUPPORT = ... # type: int
EAFNOSUPPORT = ... # type: int
EADDRINUSE = ... # type: int
EADDRNOTAVAIL = ... # type: int
ENETDOWN = ... # type: int
ENETUNREACH = ... # type: int
ENETRESET = ... # type: int
ECONNABORTED = ... # type: int
ECONNRESET = ... # type: int
ENOBUFS = ... # type: int
EISCONN = ... # type: int
ENOTCONN = ... # type: int
ESHUTDOWN = ... # type: int
ETOOMANYREFS = ... # type: int
ETIMEDOUT = ... # type: int
ECONNREFUSED = ... # type: int
EHOSTDOWN = ... # type: int
EHOSTUNREACH = ... # type: int
EALREADY = ... # type: int
EINPROGRESS = ... # type: int
ESTALE = ... # type: int
EUCLEAN = ... # type: int
ENOTNAM = ... # type: int
ENAVAIL = ... # type: int
EISNAM = ... # type: int
EREMOTEIO = ... # type: int
EDQUOT = ... # type: int

View File

@@ -1,76 +1,29 @@
from typing import Union
import io
FASYNC = ... # type: int
FD_CLOEXEC = ... # type: int
FASYNC = 64
DN_ACCESS = ... # type: int
DN_ATTRIB = ... # type: int
DN_CREATE = ... # type: int
DN_DELETE = ... # type: int
DN_MODIFY = ... # type: int
DN_MULTISHOT = ... # type: int
DN_RENAME = ... # type: int
F_DUPFD = ... # type: int
F_EXLCK = ... # type: int
F_GETFD = ... # type: int
F_GETFL = ... # type: int
F_GETLEASE = ... # type: int
F_GETLK = ... # type: int
F_GETLK64 = ... # type: int
F_GETOWN = ... # type: int
F_GETSIG = ... # type: int
F_NOTIFY = ... # type: int
F_RDLCK = ... # type: int
F_SETFD = ... # type: int
F_SETFL = ... # type: int
F_SETLEASE = ... # type: int
F_SETLK = ... # type: int
F_SETLK64 = ... # type: int
F_SETLKW = ... # type: int
F_SETLKW64 = ... # type: int
F_SETOWN = ... # type: int
F_SETSIG = ... # type: int
F_SHLCK = ... # type: int
F_UNLCK = ... # type: int
F_WRLCK = ... # type: int
I_ATMARK = ... # type: int
I_CANPUT = ... # type: int
I_CKBAND = ... # type: int
I_FDINSERT = ... # type: int
I_FIND = ... # type: int
I_FLUSH = ... # type: int
I_FLUSHBAND = ... # type: int
I_GETBAND = ... # type: int
I_GETCLTIME = ... # type: int
I_GETSIG = ... # type: int
I_GRDOPT = ... # type: int
I_GWROPT = ... # type: int
I_LINK = ... # type: int
I_LIST = ... # type: int
I_LOOK = ... # type: int
I_NREAD = ... # type: int
I_PEEK = ... # type: int
I_PLINK = ... # type: int
I_POP = ... # type: int
I_PUNLINK = ... # type: int
I_PUSH = ... # type: int
I_RECVFD = ... # type: int
I_SENDFD = ... # type: int
I_SETCLTIME = ... # type: int
I_SETSIG = ... # type: int
I_SRDOPT = ... # type: int
I_STR = ... # type: int
I_SWROPT = ... # type: int
I_UNLINK = ... # type: int
LOCK_EX = ... # type: int
LOCK_MAND = ... # type: int
LOCK_NB = ... # type: int
LOCK_READ = ... # type: int
LOCK_RW = ... # type: int
LOCK_SH = ... # type: int
LOCK_UN = ... # type: int
LOCK_WRITE = ... # type: int
FD_CLOEXEC = 1
F_DUPFD = 0
F_FULLFSYNC = 51
F_GETFD = 1
F_GETFL = 3
F_GETLK = 7
F_GETOWN = 5
F_RDLCK = 1
F_SETFD = 2
F_SETFL = 4
F_SETLK = 8
F_SETLKW = 9
F_SETOWN = 6
F_UNLCK = 2
F_WRLCK = 3
LOCK_EX = 2
LOCK_NB = 4
LOCK_SH = 1
LOCK_UN = 8
_ANYFILE = Union[int, io.IOBase]

View File

@@ -6,8 +6,8 @@ def enable() -> None: ...
def disable() -> None: ...
def isenabled() -> bool: ...
def collect(generation: int = None) -> int: ...
def set_debug(flags: int) -> None: ...
def get_debug() -> int: ...
def set_debug(flags: Any) -> None: ...
def get_debug() -> Any: ...
def get_objects() -> List[Any]: ...
def set_threshold(threshold0: int, threshold1: int = None, threshold2: int = None) -> None: ...
def get_count() -> Tuple[int, int, int]: ...

View File

@@ -1,34 +1,34 @@
"""Stubs for the 'imp' module."""
from typing import List, Optional, Tuple, Iterable, IO, Any
import types
C_BUILTIN = ... # type: int
C_EXTENSION = ... # type: int
IMP_HOOK = ... # type: int
PKG_DIRECTORY = ... # type: int
PY_CODERESOURCE = ... # type: int
PY_COMPILED = ... # type: int
PY_FROZEN = ... # type: int
PY_RESOURCE = ... # type: int
PY_SOURCE = ... # type: int
SEARCH_ERROR = ... # type: int
def acquire_lock() -> None: ...
def find_module(name: str, path: Iterable[str] = None) -> Optional[Tuple[str, str, Tuple[str, str, int]]]: ...
def get_magic() -> str: ...
def get_suffixes() -> List[Tuple[str, str, int]]: ...
PY_SOURCE = 0
PY_COMPILED = 0
C_EXTENSION = 0
def find_module(name: str, path: Iterable[str] = None) -> Optional[Tuple[str, str, Tuple[str, str, int]]]: ...
# TODO: module object
def load_module(name: str, file: str, pathname: str, description: Tuple[str, str, int]) -> types.ModuleType: ...
def new_module(name: str) -> types.ModuleType: ...
def lock_held() -> bool: ...
def acquire_lock() -> None: ...
def release_lock() -> None: ...
PKG_DIRECTORY = 0
C_BUILTIN = 0
PY_FROZEN = 0
SEARCH_ERROR = 0
def init_builtin(name: str) -> types.ModuleType: ...
def init_frozen(name: str) -> types.ModuleType: ...
def is_builtin(name: str) -> int: ...
def is_frozen(name: str) -> bool: ...
def load_compiled(name: str, pathname: str, file: IO[Any] = None) -> types.ModuleType: ...
def load_dynamic(name: str, pathname: str, file: IO[Any] = None) -> types.ModuleType: ...
def load_module(name: str, file: str, pathname: str, description: Tuple[str, str, int]) -> types.ModuleType: ...
def load_source(name: str, pathname: str, file: IO[Any] = None) -> types.ModuleType: ...
def lock_held() -> bool: ...
def new_module(name: str) -> types.ModuleType: ...
def release_lock() -> None: ...
class NullImporter:
def __init__(self, path_string: str) -> None: ...

View File

@@ -0,0 +1,81 @@
# Stubs for itertools
# Based on https://docs.python.org/2/library/itertools.html
from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple,
Union, Sequence)
_T = TypeVar('_T')
_S = TypeVar('_S')
def count(start: int = 0,
step: int = 1) -> Iterator[int]: ... # more general types?
def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ...
def repeat(object: _T, times: int = ...) -> Iterator[_T]: ...
def accumulate(iterable: Iterable[_T]) -> Iterator[_T]: ...
def chain(*iterables: Iterable[_T]) -> Iterator[_T]: ...
# TODO chain.from_Iterable
def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ...
def dropwhile(predicate: Callable[[_T], Any],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def ifilter(predicate: Callable[[_T], Any],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def ifilterfalse(predicate: Callable[[_T], Any],
iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def groupby(iterable: Iterable[_T]) -> Iterator[Tuple[_T, Iterator[_T]]]: ...
@overload
def groupby(iterable: Iterable[_T],
key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ...
@overload
def islice(iterable: Iterable[_T], stop: int) -> Iterator[_T]: ...
@overload
def islice(iterable: Iterable[_T], start: int, stop: int,
step: int = 1) -> Iterator[_T]: ...
_T1 = TypeVar('_T1')
_T2 = TypeVar('_T2')
_T3 = TypeVar('_T3')
_T4 = TypeVar('_T4')
@overload
def imap(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterable[_S]: ...
@overload
def imap(func: Callable[[_T1, _T2], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterable[_S]: ... # TODO more than two iterables
def starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: ...
def takewhile(predicate: Callable[[_T], Any],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def tee(iterable: Iterable[Any], n: int = 2) -> Iterator[Any]: ...
@overload
def izip(iter1: Iterable[_T1]) -> Iterable[Tuple[_T1]]: ...
@overload
def izip(iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterable[Tuple[_T1, _T2]]: ...
@overload
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> Iterable[Tuple[_T1, _T2, _T3]]: ...
@overload
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> Iterable[Tuple[_T1, _T2,
_T3, _T4]]: ... # TODO more than four iterables
def izip_longest(*p: Iterable[Any],
fillvalue: Any = None) -> Iterator[Any]: ...
# TODO: Return type should be Iterator[Tuple[..]], but unknown tuple shape.
# Iterator[Sequence[_T]] loses this type information.
def product(*p: Iterable[_T], repeat: int = 1) -> Iterator[Sequence[_T]]: ...
def permutations(iterable: Iterable[_T],
r: int = None) -> Iterator[Sequence[_T]]: ...
def combinations(iterable: Iterable[_T],
r: int) -> Iterable[Sequence[_T]]: ...
def combinations_with_replacement(iterable: Iterable[_T],
r: int) -> Iterable[Sequence[_T]]: ...

8
builtins/2.7/marshal.pyi Normal file
View File

@@ -0,0 +1,8 @@
from typing import Any, IO
def dump(value: Any, file: IO[Any], version: int = None) -> None: ...
def load(file: IO[Any]) -> Any: ...
def dumps(value: Any, version: int = None) -> str: ...
def loads(string: str) -> Any: ...
version = ... # type: int

52
builtins/2.7/math.pyi Normal file
View File

@@ -0,0 +1,52 @@
# Stubs for math
# Ron Murawski <ron@horizonchess.com>
# based on: http://docs.python.org/2/library/math.html
from typing import overload, Tuple, Iterable
# ----- variables and constants -----
e = 0.0
pi = 0.0
# ----- functions -----
def ceil(x: float) -> int: ...
def copysign(x: float, y: float) -> float: ...
def fabs(x: float) -> float: ...
def factorial(x: int) -> int: ...
def floor(x: float) -> int: ...
def fmod(x: float, y: float) -> float: ...
def frexp(x: float) -> Tuple[float, int]: ...
def fsum(iterable: Iterable) -> float: ...
def isinf(x: float) -> bool: ...
def isnan(x: float) -> bool: ...
def ldexp(x: float, i: int) -> float: ...
def modf(x: float) -> Tuple[float, float]: ...
def trunc(x: float) -> float: ...
def exp(x: float) -> float: ...
def expm1(x: float) -> float: ...
def log(x: float, base: float = ...) -> float: ...
def log1p(x: float) -> float: ...
def log10(x: float) -> float: ...
def pow(x: float, y: float) -> float: ...
def sqrt(x: float) -> float: ...
def acos(x: float) -> float: ...
def asin(x: float) -> float: ...
def atan(x: float) -> float: ...
def atan2(y: float, x: float) -> float: ...
def cos(x: float) -> float: ...
def hypot(x: float, y: float) -> float: ...
def sin(x: float) -> float: ...
def tan(x: float) -> float: ...
def degrees(x: float) -> float: ...
def radians(x: float) -> float: ...
def acosh(x: float) -> float: ...
def asinh(x: float) -> float: ...
def atanh(x: float) -> float: ...
def cosh(x: float) -> float: ...
def sinh(x: float) -> float: ...
def tanh(x: float) -> float: ...
def erf(x: object) -> float: ...
def erfc(x: object) -> float: ...
def gamma(x: object) -> float: ...
def lgamma(x: object) -> float: ...

View File

@@ -1,124 +1,16 @@
# Stubs for operator
# NOTE: These are incomplete!
from typing import Any
def __abs__(a: Any) -> Any: ...
def __add__(a: Any, b: Any) -> Any: ...
def __and__(a: Any, b: Any) -> Any: ...
def __concat__(a: Any, b: Any) -> Any: ...
def __contains__(container: Any, item: Any) -> bool: ...
def __delitem__(container: Any, item: Any) -> None: ...
def __delslice__(container: Any, b: int, c: int) -> None: ...
def __div__(a: Any, b: Any) -> Any: ...
def __eq__(a: Any, b: Any) -> Any: ...
def __floordiv__(a: Any, b: Any) -> Any: ...
def __ge__(a: Any, b: Any) -> Any: ...
def __getitem__(container: Any, key: Any) -> Any: ...
def __getslice__(container, b: int, c: int) -> Any: ...
def __gt__(a: Any, b: Any) -> Any: ...
def __iadd__(a: Any, b: Any) -> Any: ...
def __iand__(a: Any, b: Any) -> Any: ...
def __iconcat__(a: Any, b: Any) -> Any: ...
def __idiv__(a: Any, b: Any) -> Any: ...
def __ifloordiv__(a: Any, b: Any) -> Any: ...
def __ilshift__(a: Any, b: Any) -> Any: ...
def __imod__(a: Any, b: Any) -> Any: ...
def __imul__(a: Any, b: Any) -> Any: ...
def __index__(x: Any) -> Any: ...
def __inv__(x: Any) -> Any: ...
def __invert__(x: Any) -> Any: ...
def __ior__(a: Any, b: Any) -> Any: ...
def __ipow__(a: Any, b: Any) -> Any: ...
def __irepeat__(a: Any, b: int) -> Any: ...
def __irshift__(a: Any, b: Any) -> Any: ...
def __isub__(a: Any, b: Any) -> Any: ...
def __itruediv__(a: Any, b: Any) -> Any: ...
def __ixor__(a: Any, b: Any) -> Any: ...
def __le__(a: Any, b: Any) -> Any: ...
def __lshift__(a: Any, b: Any) -> Any: ...
def __lt__(a: Any, b: Any) -> Any: ...
def __mod__(a: Any, b: Any) -> Any: ...
def __mul__(a: Any, b: Any) -> Any: ...
def __ne__(a: Any, b: Any) -> Any: ...
def __neg__(x: Any) -> Any: ...
def __not__(x: Any) -> bool: ...
def __or__(a: Any, b: Any) -> Any: ...
def __pos__(x: Any) -> Any: ...
def __pow__(a: Any, b: Any) -> Any: ...
def __repeat__(a, b: int) -> Any: ...
def __rshift__(a: Any, b: Any) -> Any: ...
def __setitem__(container: Any, b: Any) -> None: ...
def __setslice__(container: Any, b: int, c: int, item: Any) -> None: ...
def __sub__(a: Any, b: Any) -> Any: ...
def __truediv__(a: Any, b: Any) -> Any: ...
def __xor__(a: Any, b: Any) -> Any: ...
def abs(x: Any) -> Any: ...
def add(a: Any, b: Any) -> Any: ...
def and_(a: Any, b: Any) -> Any: ...
def concat(a: Any, b: Any) -> Any: ...
def contains(container: Any, item: Any) -> bool: ...
def countOf(container: Any, item: Any) -> int: ...
def delitem(container: Any, item: Any) -> None: ...
def delslice(container: Any, b: int, c: int) -> None: ...
def div(a: Any, b: Any) -> Any: ...
def eq(a: Any, b: Any) -> Any: ...
def floordiv(a: Any, b: Any) -> Any: ...
def ge(a: Any, b: Any) -> Any: ...
def getitem(a: Any, b: Any) -> Any: ...
def getslice(container: Any, b: int, c: int) -> Any: ...
def gt(a: Any, b: Any) -> Any: ...
def iadd(a: Any, b: Any) -> Any: ...
def iand(a: Any, b: Any) -> Any: ...
def iconcat(a: Any, b: Any) -> Any: ...
def idiv(a: Any, b: Any) -> Any: ...
def ifloordiv(a: Any, b: Any) -> Any: ...
def ilshift(a: Any, b: Any) -> Any: ...
def imod(a: Any, b: Any) -> Any: ...
def imul(a: Any, b: Any) -> Any: ...
def index(x: Any) -> Any: ...
def indexOf(container: Any, item: Any) -> int: ...
def inv(x: Any) -> Any: ...
def invert(x: Any) -> Any: ...
def ior(a: Any, b: Any) -> Any: ...
def ipow(a: Any, b: Any) -> Any: ...
def irepeat(a, b: int) -> Any: ...
def irshift(a: Any, b: Any) -> Any: ...
def isCallable(x: Any) -> bool: ...
def isMappingType(x: Any) -> bool: ...
def isNumberType(x: Any) -> bool: ...
def isSequenceType(x: Any) -> bool: ...
def is_(a: Any, b: Any) -> bool: ...
def is_not(a: Any, b: Any) -> bool: ...
def isub(a: Any, b: Any) -> Any: ...
def itruediv(a: Any, b: Any) -> Any: ...
def ixor(a: Any, b: Any) -> Any: ...
def le(a: Any, b: Any) -> Any: ...
def lshift(a: Any, b: Any) -> Any: ...
def lt(a: Any, b: Any) -> Any: ...
def mod(a: Any, b: Any) -> Any: ...
def mul(a: Any, b: Any) -> Any: ...
def le(a: Any, b: Any) -> Any: ...
def eq(a: Any, b: Any) -> Any: ...
def ne(a: Any, b: Any) -> Any: ...
def neg(x: Any) -> Any: ...
def not_(x: Any) -> bool: ...
def or_(a: Any, b: Any) -> Any: ...
def pos(x: Any) -> Any: ...
def pow(a: Any, b: Any) -> Any: ...
def repeat(a, b: int) -> Any: ...
def rshift(a: Any, b: Any) -> Any: ...
def sequenceIncludes(seq1: Any, seq2: Any) -> bool: ...
def setitem(container: Any, key: Any, item: Any) -> None: ...
def setslice(container: Any, b: int, c: int, slice: Any) -> None: ...
def sub(a: Any, b: Any) -> Any: ...
def truediv(a: Any, b: Any) -> Any: ...
def truth(x: Any) -> bool: ...
def xor(a: Any, b: Any) -> Any: ...
class attrgetter(object):
def __init__(self, name: Any): ...
class itemgetter(object):
def __init__(self, key: Any): ...
class methodcaller(object):
def __init__(self, method_name: str, *args, **kwargs): ...
def gt(a: Any, b: Any) -> Any: ...
def ge(a: Any, b: Any) -> Any: ...

33
builtins/2.7/resource.pyi Normal file
View File

@@ -0,0 +1,33 @@
from typing import Tuple, NamedTuple
class error(Exception): ...
RLIM_INFINITY = ... # type: int
def getrlimit(resource: int) -> Tuple[int, int]: ...
def setrlimit(resource: int, limits: Tuple[int, int]) -> None: ...
RLIMIT_CORE = ... # type: int
RLIMIT_CPU = ... # type: int
RLIMIT_FSIZE = ... # type: int
RLIMIT_DATA = ... # type: int
RLIMIT_STACK = ... # type: int
RLIMIT_RSS = ... # type: int
RLIMIT_NPROC = ... # type: int
RLIMIT_NOFILE = ... # type: int
RLIMIT_OFILE= ... # type: int
RLIMIT_MEMLOCK = ... # type: int
RLIMIT_VMEM = ... # type: int
RLIMIT_AS = ... # type: int
_RUsage = NamedTuple('_RUsage', [('ru_utime', float), ('ru_stime', float), ('ru_maxrss', int),
('ru_ixrss', int), ('ru_idrss', int), ('ru_isrss', int),
('ru_minflt', int), ('ru_majflt', int), ('ru_nswap', int),
('ru_inblock', int), ('ru_oublock', int), ('ru_msgsnd', int),
('ru_msgrcv', int), ('ru_nsignals', int), ('ru_nvcsw', int),
('ru_nivcsw', int)])
def getrusage(who: int) -> _RUsage: ...
def getpagesize() -> int: ...
RUSAGE_SELF = ... # type: int
RUSAGE_CHILDREN = ... # type: int
RUSAGE_BOTH = ... # type: int

View File

@@ -1,101 +1,109 @@
"""Stubs for the 'select' module."""
# Stubs for select (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, Optional
from typing import Any
EPOLLERR = ... # type: int
EPOLLET = ... # type: int
EPOLLHUP = ... # type: int
EPOLLIN = ... # type: int
EPOLLMSG = ... # type: int
EPOLLONESHOT = ... # type: int
EPOLLOUT = ... # type: int
EPOLLPRI = ... # type: int
EPOLLRDBAND = ... # type: int
EPOLLRDNORM = ... # type: int
EPOLLWRBAND = ... # type: int
EPOLLWRNORM = ... # type: int
EPOLL_RDHUP = ... # type: int
KQ_EV_ADD = ... # type: int
KQ_EV_CLEAR = ... # type: int
KQ_EV_DELETE = ... # type: int
KQ_EV_DISABLE = ... # type: int
KQ_EV_ENABLE = ... # type: int
KQ_EV_EOF = ... # type: int
KQ_EV_ERROR = ... # type: int
KQ_EV_FLAG1 = ... # type: int
KQ_EV_ONESHOT = ... # type: int
KQ_EV_SYSFLAGS = ... # type: int
KQ_FILTER_AIO = ... # type: int
KQ_FILTER_NETDEV = ... # type: int
KQ_FILTER_PROC = ... # type: int
KQ_FILTER_READ = ... # type: int
KQ_FILTER_SIGNAL = ... # type: int
KQ_FILTER_TIMER = ... # type: int
KQ_FILTER_VNODE = ... # type: int
KQ_FILTER_WRITE = ... # type: int
KQ_NOTE_ATTRIB = ... # type: int
KQ_NOTE_CHILD = ... # type: int
KQ_NOTE_DELETE = ... # type: int
KQ_NOTE_EXEC = ... # type: int
KQ_NOTE_EXIT = ... # type: int
KQ_NOTE_EXTEND = ... # type: int
KQ_NOTE_FORK = ... # type: int
KQ_NOTE_LINK = ... # type: int
KQ_NOTE_LINKDOWN = ... # type: int
KQ_NOTE_LINKINV = ... # type: int
KQ_NOTE_LINKUP = ... # type: int
KQ_NOTE_LOWAT = ... # type: int
KQ_NOTE_PCTRLMASK = ... # type: int
KQ_NOTE_PDATAMASK = ... # type: int
KQ_NOTE_RENAME = ... # type: int
KQ_NOTE_REVOKE = ... # type: int
KQ_NOTE_TRACK = ... # type: int
KQ_NOTE_TRACKERR = ... # type: int
KQ_NOTE_WRITE = ... # type: int
PIPE_BUF = ... # type: int
POLLERR = ... # type: int
POLLHUP = ... # type: int
POLLIN = ... # type: int
POLLMSG = ... # type: int
POLLNVAL = ... # type: int
POLLOUT = ... # type: int
POLLPRI = ... # type: int
POLLRDBAND = ... # type: int
POLLRDNORM = ... # type: int
POLLWRBAND = ... # type: int
POLLWRNORM = ... # type: int
KQ_EV_ADD = ... # type: int
KQ_EV_CLEAR = ... # type: int
KQ_EV_DELETE = ... # type: int
KQ_EV_DISABLE = ... # type: int
KQ_EV_ENABLE = ... # type: int
KQ_EV_EOF = ... # type: int
KQ_EV_ERROR = ... # type: int
KQ_EV_FLAG1 = ... # type: int
KQ_EV_ONESHOT = ... # type: int
KQ_EV_SYSFLAGS = ... # type: int
KQ_FILTER_AIO = ... # type: int
KQ_FILTER_PROC = ... # type: int
KQ_FILTER_READ = ... # type: int
KQ_FILTER_SIGNAL = ... # type: int
KQ_FILTER_TIMER = ... # type: int
KQ_FILTER_VNODE = ... # type: int
KQ_FILTER_WRITE = ... # type: int
KQ_NOTE_ATTRIB = ... # type: int
KQ_NOTE_CHILD = ... # type: int
KQ_NOTE_DELETE = ... # type: int
KQ_NOTE_EXEC = ... # type: int
KQ_NOTE_EXIT = ... # type: int
KQ_NOTE_EXTEND = ... # type: int
KQ_NOTE_FORK = ... # type: int
KQ_NOTE_LINK = ... # type: int
KQ_NOTE_LOWAT = ... # type: int
KQ_NOTE_PCTRLMASK = ... # type: int
KQ_NOTE_PDATAMASK = ... # type: int
KQ_NOTE_RENAME = ... # type: int
KQ_NOTE_REVOKE = ... # type: int
KQ_NOTE_TRACK = ... # type: int
KQ_NOTE_TRACKERR = ... # type: int
KQ_NOTE_WRITE = ... # type: int
PIPE_BUF = ... # type: int
POLLERR = ... # type: int
POLLHUP = ... # type: int
POLLIN = ... # type: int
POLLNVAL = ... # type: int
POLLOUT = ... # type: int
POLLPRI = ... # type: int
POLLRDBAND = ... # type: int
POLLRDNORM = ... # type: int
POLLWRBAND = ... # type: int
POLLWRNORM = ... # type: int
EPOLLIN = ... # type: int
EPOLLOUT = ... # type: int
EPOLLPRI = ... # type: int
EPOLLERR = ... # type: int
EPOLLHUP = ... # type: int
EPOLLET = ... # type: int
EPOLLONESHOT = ... # type: int
EPOLLRDNORM = ... # type: int
EPOLLRDBAND = ... # type: int
EPOLLWRNORM = ... # type: int
EPOLLWRBAND = ... # type: int
EPOLLMSG = ... # type: int
def poll() -> epoll: ...
def select(rlist, wlist, xlist, timeout: Optional[int]) -> Tuple[List, List, List]: ...
def poll(): ...
def select(rlist, wlist, xlist, timeout=...): ...
class error(Exception): ...
class error(Exception):
characters_written = ... # type: Any
errno = ... # type: Any
filename = ... # type: Any
filename2 = ... # type: Any
strerror = ... # type: Any
def __init__(self, *args, **kwargs): ...
def __reduce__(self): ...
class kevent(object):
class kevent:
data = ... # type: Any
fflags = ... # type: int
filter = ... # type: int
flags = ... # type: int
fflags = ... # type: Any
filter = ... # type: Any
flags = ... # type: Any
ident = ... # type: Any
udata = ... # type: Any
__hash__ = ... # type: Any
def __init__(self, *args, **kwargs): ...
def __eq__(self, other): ...
def __ge__(self, other): ...
def __gt__(self, other): ...
def __le__(self, other): ...
def __lt__(self, other): ...
def __ne__(self, other): ...
class kqueue(object):
closed = ... # type: bool
def __init__(self) -> None: ...
def close(self) -> None: ...
def control(self, changelist: Optional[Iterable[kevent]], max_events: int, timeout: int = ...) -> List[kevent]: ...
def fileno(self) -> int: ...
class kqueue:
closed = ... # type: Any
def __init__(self, *args, **kwargs): ...
def close(self): ...
def control(self, *args, **kwargs): ...
def fileno(self): ...
@classmethod
def fromfd(cls, fd: int) -> kqueue: ...
def fromfd(cls, fd): ...
class epoll(object):
class epoll:
def __init__(self, sizehint: int = ...) -> None: ...
def close(self) -> None: ...
def fileno(self) -> int: ...
def fromfd(self, fd): ...
def register(self, fd: int, eventmask: int = ...) -> None: ...
def modify(self, fd: int, eventmask: int) -> None: ...
def unregister(fd: int) -> None: ...
def poll(timeout: float = ..., maxevents: int = ...) -> Any: ...
@classmethod
def fromfd(self, fd: int) -> epoll: ...

View File

@@ -1,66 +1,60 @@
from typing import Callable, Any, Tuple, Union
SIG_DFL = ... # type: long
SIG_IGN = ... # type: long
ITIMER_REAL = ... # type: long
ITIMER_VIRTUAL = ... # type: long
ITIMER_PROF = ... # type: long
SIG_DFL = 0
SIG_IGN = 0
SIGABRT = ... # type: int
SIGALRM = ... # type: int
SIGBUS = ... # type: int
SIGCHLD = ... # type: int
SIGCLD = ... # type: int
SIGCONT = ... # type: int
SIGFPE = ... # type: int
SIGHUP = ... # type: int
SIGILL = ... # type: int
SIGINT = ... # type: int
SIGIO = ... # type: int
SIGIOT = ... # type: int
SIGKILL = ... # type: int
SIGPIPE = ... # type: int
SIGPOLL = ... # type: int
SIGPROF = ... # type: int
SIGPWR = ... # type: int
SIGQUIT = ... # type: int
SIGRTMAX = ... # type: int
SIGRTMIN = ... # type: int
SIGSEGV = ... # type: int
SIGSTOP = ... # type: int
SIGSYS = ... # type: int
SIGTERM = ... # type: int
SIGTRAP = ... # type: int
SIGTSTP = ... # type: int
SIGTTIN = ... # type: int
SIGTTOU = ... # type: int
SIGURG = ... # type: int
SIGUSR1 = ... # type: int
SIGUSR2 = ... # type: int
SIGVTALRM = ... # type: int
SIGWINCH = ... # type: int
SIGXCPU = ... # type: int
SIGXFSZ = ... # type: int
NSIG = ... # type: int
SIGABRT = 0
SIGALRM = 0
SIGBUS = 0
SIGCHLD = 0
SIGCLD = 0
SIGCONT = 0
SIGFPE = 0
SIGHUP = 0
SIGILL = 0
SIGINT = 0
SIGIO = 0
SIGIOT = 0
SIGKILL = 0
SIGPIPE = 0
SIGPOLL = 0
SIGPROF = 0
SIGPWR = 0
SIGQUIT = 0
SIGRTMAX = 0
SIGRTMIN = 0
SIGSEGV = 0
SIGSTOP = 0
SIGSYS = 0
SIGTERM = 0
SIGTRAP = 0
SIGTSTP = 0
SIGTTIN = 0
SIGTTOU = 0
SIGURG = 0
SIGUSR1 = 0
SIGUSR2 = 0
SIGVTALRM = 0
SIGWINCH = 0
SIGXCPU = 0
SIGXFSZ = 0
# Python 3 only:
CTRL_C_EVENT = 0
CTRL_BREAK_EVENT = 0
GSIG = 0
ITIMER_REAL = 0
ITIMER_VIRTUAL = 0
ITIMER_PROF = 0
class ItimerError(IOError): ...
_HANDLER = Union[Callable[[int, Any], Any], int, None]
def alarm(time: int) -> int: ...
def alarm(time: float) -> int: ...
def getsignal(signalnum: int) -> _HANDLER: ...
def pause() -> None: ...
def setitimer(which: int, seconds: float, interval: float = None) -> Tuple[float, float]: ...
def getitimer(which: int) -> Tuple[float, float]: ...
def set_wakeup_fd(fd: int) -> long: ...
def siginterrupt(signalnum: int, flag: bool) -> None:
raise RuntimeError()
def signal(signalnum: int, handler: _HANDLER) -> None:
raise RuntimeError()
def default_int_handler(*args, **kwargs) -> Any:
raise KeyboardInterrupt()
def set_wakeup_fd(fd: int) -> None: ...
def siginterrupt(signalnum: int, flag: bool) -> None: ...
def signal(signalnum: int, handler: _HANDLER) -> None: ...

View File

@@ -1,39 +1,102 @@
"""Stubs for the 'sys' module."""
# Stubs for sys
# Ron Murawski <ron@horizonchess.com>
# based on http://docs.python.org/2.7/library/sys.html
# Partially adapted to Python 2.7 by Jukka Lehtosalo.
from typing import (
List, Sequence, Any, Dict, Tuple, BinaryIO, overload
)
class _flags:
bytes_warning = ... # type: int
debug = ... # type: int
division_new = ... # type: int
division_warning = ... # type: int
dont_write_bytecode = ... # type: int
hash_randomization = ... # type: int
ignore_environment = ... # type: int
inspect = ... # type: int
interactive = ... # type: int
no_site = ... # type: int
no_user_site = ... # type: int
optimize = ... # type: int
py3k_warning = ... # type: int
tabcheck = ... # type: int
unicode = ... # type: int
verbose = ... # type: int
# ----- sys variables -----
abiflags = ''
argv = None # type: List[str]
byteorder = ''
builtin_module_names = None # type: Sequence[str] # actually a tuple of strings
copyright = ''
dllhandle = 0 # Windows only
dont_write_bytecode = False
__displayhook__ = None # type: Any # contains the original value of displayhook
__excepthook__ = None # type: Any # contains the original value of excepthook
exec_prefix = ''
executable = ''
float_repr_style = ''
hexversion = 0 # this is a 32-bit int
last_type = None # type: Any
last_value = None # type: Any
last_traceback = None # type: Any
maxsize = 0
maxunicode = 0
meta_path = None # type: List[Any]
modules = None # type: Dict[str, Any]
path = None # type: List[str]
path_hooks = None # type: List[Any] # TODO precise type; function, path to finder
path_importer_cache = None # type: Dict[str, Any] # TODO precise type
platform = ''
prefix = ''
ps1 = ''
ps2 = ''
stdin = None # type: BinaryIO
stdout = None # type: BinaryIO
stderr = None # type: BinaryIO
__stdin__ = None # type: BinaryIO
__stdout__ = None # type: BinaryIO
__stderr__ = None # type: BinaryIO
subversion = None # type: Tuple[str, str, str]
tracebacklimit = 0
version = ''
api_version = 0
warnoptions = None # type: Any
# Each entry is a tuple of the form (action, message, category, module,
# lineno)
winver = '' # Windows only
_xoptions = None # type: Dict[Any, Any]
flags = None # type: _flags
class _flags:
debug = 0
division_warning = 0
inspect = 0
interactive = 0
optimize = 0
dont_write_bytecode = 0
no_user_site = 0
no_site = 0
ignore_environment = 0
verbose = 0
bytes_warning = 0
quiet = 0
hash_randomization = 0
float_info = None # type: _float_info
class _float_info:
max = ... # type: float
max_exp = ... # type: int
max_10_exp = ... # type: int
min = ... # type: float
min_exp = ... # type: int
min_10_exp = ... # type: int
dig = ... # type: int
mant_dig = ... # type: int
epsilon = ... # type: float
radix = ... # type: int
rounds = ... # type: int
epsilon = 0.0 # DBL_EPSILON
dig = 0 # DBL_DIG
mant_dig = 0 # DBL_MANT_DIG
max = 0.0 # DBL_MAX
max_exp = 0 # DBL_MAX_EXP
max_10_exp = 0 # DBL_MAX_10_EXP
min = 0.0 # DBL_MIN
min_exp = 0 # DBL_MIN_EXP
min_10_exp = 0 # DBL_MIN_10_EXP
radix = 0 # FLT_RADIX
rounds = 0 # FLT_ROUNDS
hash_info = None # type: _hash_info
class _hash_info:
width = 0 # width in bits used for hash values
modulus = 0 # prime modulus P used for numeric hash scheme
inf = 0 # hash value returned for a positive infinity
nan = 0 # hash value returned for a nan
imag = 0 # multiplier used for the imaginary part of a complex number
int_info = None # type: _int_info
class _int_info:
bits_per_digit = 0 # number of bits held in each digit. Python integers
# are stored internally in
# base 2**int_info.bits_per_digit
sizeof_digit = 0 # size in bytes of C type used to represent a digit
class _version_info(Tuple[int, int, int, str, int]):
major = 0
@@ -41,73 +104,49 @@ class _version_info(Tuple[int, int, int, str, int]):
micro = 0
releaselevel = ''
serial = 0
version_info = None # type: _version_info
_mercurial = ... # type: tuple
api_version = ... # type: int
argv = ... # type: List[str]
builtin_module_names = ... # type: List[str]
byteorder = ... # type: str
copyright = ... # type: str
dont_write_bytecode = ... # type: bool
exec_prefix = ... # type: str
executable = ... # type: str
flags = ... # type: _flags
float_repr_style = ... # type: str
hexversion = ... # type: int
long_info = ... # type: object
maxint = ... # type: int
maxsize = ... # type: int
maxunicode = ... # type: int
modules = ... # type: Dict[str, module]
path = ... # type: List[str]
platform = ... # type: str
prefix = ... # type: str
py3kwarning = ... # type: bool
stderr = ... # type: file
stdin = ... # type: file
stdout = ... # type: file
subversion = ... # type: tuple
version = ... # type: str
version_info = ... # type: Tuple[int]
warnoptions = ... # type: object
float_info = ... # type: _float_info
version_info = ... # type: _version_info
class _WindowsVersionType:
major = ... # type: Any
minor = ... # type: Any
build = ... # type: Any
platform = ... # type: Any
service_pack = ... # type: Any
service_pack_major = ... # type: Any
service_pack_minor = ... # type: Any
suite_mask = ... # type: Any
product_type = ... # type: Any
def getwindowsversion() -> _WindowsVersionType: ... # TODO return type
# ----- sys function stubs -----
def call_tracing(fn: Any, args: Any) -> object: ...
def _clear_type_cache() -> None: ...
def _current_frames() -> Dict[int, Any]: ...
def _getframe(depth: int = ...) -> Any: ... # TODO: Return FrameObject
def call_tracing(fn: Any, args: Any) -> Any: ...
def displayhook(value: int) -> None: ... # value might be None
def excepthook(type_: type, value: BaseException, traceback: Any) -> None: ... # TODO traceback type
def exc_clear() -> None:
raise DeprecationWarning()
def exc_info() -> Tuple[type, Any, Any]: ... # TODO traceback type
def exit(arg: int = ...) -> None:
raise SystemExit()
def excepthook(type_: type, value: BaseException, traceback: Any) -> None:
# TODO traceback type
...
def exc_info() -> Tuple[type, Any, Any]: ... # see above
def exit(arg: int = 0) -> None: ... # arg might be None
def getcheckinterval() -> int: ... # deprecated
def getdefaultencoding() -> str: ...
def getdlopenflags() -> int: ...
def getfilesystemencoding() -> Union[str, None]: ...
def getfilesystemencoding() -> str: ...
def getrefcount(object) -> int: ...
def getrecursionlimit() -> int: ...
def getsizeof(obj: object, default: int = ...) -> int: ...
def getprofile() -> None: ...
def gettrace() -> None: ...
@overload
def getsizeof(obj: object) -> int: ...
@overload
def getsizeof(obj: object, default: int) -> int: ...
def getswitchinterval() -> float: ...
@overload
def _getframe() -> Any: ...
@overload
def _getframe(depth: int) -> Any: ...
def getprofile() -> Any: ... # TODO return type
def gettrace() -> Any: ... # TODO return
def getwindowsversion() -> Any: ... # TODO return type
def intern(string: str) -> str: ...
def setcheckinterval(interval: int) -> None: ... # deprecated
def setdlopenflags(n: int) -> None: ...
def setprofile(profilefunc: Any) -> None: ... # TODO type
def setrecursionlimit(limit: int) -> None: ...
def setswitchinterval(interval: float) -> None: ...
def settrace(tracefunc: Any) -> None: ... # TODO type
# Trace functions should have three arguments: frame, event, and arg. frame
# is the current stack frame. event is a string: 'call', 'line', 'return',
# 'exception', 'c_call', 'c_return', or 'c_exception'. arg depends on the
# event type.
def settscdump(on_flag: bool) -> None: ...

View File

@@ -1,32 +1,16 @@
from typing import Callable, Any
def _count() -> int: ...
class error(Exception): ...
class LockType:
def acquire(self, waitflag: int = None) -> bool: ...
def acquire_lock(self, waitflag: int = None) -> bool: ...
def release(self) -> None: ...
def release_lock(self) -> None: ...
def locked(self) -> bool: ...
def locked_lock(self) -> bool: ...
def __enter__(self) -> LockType: ...
def __exit__(self, value: Any, traceback: Any) -> None: ...
class _local(object):
pass
class _localdummy(object):
pass
def start_new(function: Callable[..., Any], args: Any, kwargs: Any = None) -> int: ...
def start_new_thread(function: Callable[..., Any], args: Any, kwargs: Any = None) -> int: ...
def interrupt_main() -> None: ...
def exit() -> None:
raise SystemExit()
def exit_thread() -> Any:
raise SystemExit()
def exit() -> None: ...
def allocate_lock() -> LockType: ...
def get_ident() -> int: ...
def stack_size(size: int = None) -> int: ...

View File

@@ -1,5 +1,5 @@
"""Stub file for the 'time' module."""
# See https://docs.python.org/2/library/time.html
# based on autogenerated stub from typeshed and https://docs.python.org/2/library/time.html
from typing import NamedTuple, Tuple, Union

View File

@@ -1,39 +1,37 @@
"""Stubs for the 'unicodedata' module."""
# Stubs for unicodedata (Python 2.7)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, TypeVar
from typing import Any
ucd_3_2_0 = ... # type: UCD
ucnhash_CAPI = ... # type: Any (PyCapsule)
ucd_3_2_0 = ... # type: Any
ucnhash_CAPI = ... # type: Any
unidata_version = ... # type: str
_default = TypeVar("default")
def bidirectional(unichr: unicode) -> str: ...
def category(unichr: unicode) -> str: ...
def combining(unichr: unicode) -> int: ...
def decimal(chr: unicode, default=_default) -> Union[int, _default]: ...
def decomposition(unichr: unicode) -> str: ...
def digit(chr: unicode, default=_default) -> Union[int, _default]: ...
def east_asian_width(unichr: unicode): str
def lookup(name: str): unicode
def mirrored(unichr: unicode): int
def name(chr: unicode, default=_default) -> Union[str, _default]: ...
def bidirectional(unichr): ...
def category(unichr): ...
def combining(unichr): ...
def decimal(chr, default=...): ...
def decomposition(unichr): ...
def digit(chr, default=...): ...
def east_asian_width(unichr): ...
def lookup(name): ...
def mirrored(unichr): ...
def name(chr, default=...): ...
def normalize(form: str, unistr: unicode) -> unicode: ...
def numeric(chr, default=_default): Union[float, _default]: ...
def numeric(chr, default=...): ...
class UCD(object):
unidata_version = ... # type: str
# The methods below are constructed from the same array in C
# (unicodedata_functions) and hence identical to the methods above.
def bidirectional(unichr: unicode) -> str: ...
def category(unichr: unicode) -> str: ...
def combining(unichr: unicode) -> int: ...
def decimal(chr: unicode, default=_default) -> Union[int, _default]: ...
def decomposition(unichr: unicode) -> str: ...
def digit(chr: unicode, default=_default) -> Union[int, _default]: ...
def east_asian_width(unichr: unicode): str
def lookup(name: str): unicode
def mirrored(unichr: unicode): int
def name(chr: unicode, default=_default) -> Union[str, _default]: ...
def normalize(form: str, unistr: unicode) -> unicode: ...
def numeric(chr, default=_default): Union[float, _default]: ...
class UCD:
unidata_version = ... # type: Any
def bidirectional(self, unichr): ...
def category(self, unichr): ...
def combining(self, unichr): ...
def decimal(self, chr, default=...): ...
def decomposition(self, unichr): ...
def digit(self, chr, default=...): ...
def east_asian_width(self, unichr): ...
def lookup(self, name): ...
def mirrored(self, unichr): ...
def name(self, chr, default=...): ...
def normalize(self, form, unistr): ...
def numeric(self, chr, default=...): ...

View File

@@ -1,6 +1,6 @@
# Stubs for zlib (Python 2.7)
class error(Exception): ...
#
# NOTE: This stub was automatically generated by stubgen.
DEFLATED = ... # type: int
DEF_MEM_LEVEL = ... # type: int
@@ -19,18 +19,12 @@ Z_SYNC_FLUSH = ... # type: int
def adler32(data: str, value: int = ...) -> int: ...
def compress(data: str, level: int = ...) -> str: ...
# TODO: compressobj() returns a compress object
def compressobj(level: int = ..., method: int = ..., wbits: int = ..., memlevel: int = ...,
strategy: int = ...): ...
def crc32(data: str, value: int = ...) -> int: ...
def decompress(data: str, wbits: int = ..., bufsize: int = ...) -> str: ...
# TODO: decompressobj() returns a decompress object
def decompressobj(wbits: int = ...): ...
class compressobj:
def __init__(level: int = ..., method: int = ..., wbits: int = ..., memlevel: int = ...,
strategy: int = ...): ...
def compress(self, data: str) -> str: ...
def copy(self) -> _Compress: ...
def flush(self) -> NoneType: ...
class decompressobj:
def __init__(wbits: int = ...): ...
def copy(self) -> _Compress: ...
def decompress(self, data: str) -> str: ...
def flush(self) -> NoneType: ...
class error(Exception): ...

View File

@@ -34,7 +34,7 @@ def isinf(x: float) -> bool: ...
def isnan(x: float) -> bool: ...
def ldexp(x: float, i: int) -> float: ...
def lgamma(x: float) -> float: ...
def log(x: float, base: Optional[float]) -> float: ...
def log(x: float, base: float = ...) -> float: ...
def log10(x: float) -> float: ...
def log1p(x: float) -> float: ...
def modf(x: float) -> Tuple[float, float]: ...

48
builtins/3/_io.pyi Normal file
View File

@@ -0,0 +1,48 @@
# Stubs for _io (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class _IOBase:
def __init__(self, *args, **kwargs): ...
@property
def closed(self): ...
def close(self): ...
def fileno(self): ...
def flush(self): ...
def isatty(self): ...
def readable(self): ...
def readline(self, size: int = -1): ...
def readlines(self, hint: int = -1): ...
def seek(self, offset, whence=...): ...
def seekable(self): ...
def tell(self): ...
def truncate(self, size: int = None) -> int: ...
def writable(self): ...
def writelines(self, lines): ...
def __del__(self): ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb): ...
def __iter__(self): ...
def __next__(self): ...
class _BufferedIOBase(_IOBase):
def detach(self): ...
def read(self, size: int = -1): ...
def read1(self, size: int = -1): ...
def readinto(self, b): ...
def write(self, b): ...
class _RawIOBase(_IOBase):
def read(self, size: int = -1): ...
def readall(self): ...
class _TextIOBase(_IOBase):
encoding = ... # type: Any
errors = ... # type: Any
newlines = ... # type: Any
def detach(self): ...
def read(self, size: int = -1): ...
def readline(self, size: int = -1): ...
def write(self, b): ...

84
builtins/3/_locale.pyi Normal file
View File

@@ -0,0 +1,84 @@
# Stubs for _locale (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Iterable
ABDAY_1 = ... # type: int
ABDAY_2 = ... # type: int
ABDAY_3 = ... # type: int
ABDAY_4 = ... # type: int
ABDAY_5 = ... # type: int
ABDAY_6 = ... # type: int
ABDAY_7 = ... # type: int
ABMON_1 = ... # type: int
ABMON_10 = ... # type: int
ABMON_11 = ... # type: int
ABMON_12 = ... # type: int
ABMON_2 = ... # type: int
ABMON_3 = ... # type: int
ABMON_4 = ... # type: int
ABMON_5 = ... # type: int
ABMON_6 = ... # type: int
ABMON_7 = ... # type: int
ABMON_8 = ... # type: int
ABMON_9 = ... # type: int
ALT_DIGITS = ... # type: int
AM_STR = ... # type: int
CHAR_MAX = ... # type: int
CODESET = ... # type: int
CRNCYSTR = ... # type: int
DAY_1 = ... # type: int
DAY_2 = ... # type: int
DAY_3 = ... # type: int
DAY_4 = ... # type: int
DAY_5 = ... # type: int
DAY_6 = ... # type: int
DAY_7 = ... # type: int
D_FMT = ... # type: int
D_T_FMT = ... # type: int
ERA = ... # type: int
ERA_D_FMT = ... # type: int
ERA_D_T_FMT = ... # type: int
ERA_T_FMT = ... # type: int
LC_ALL = ... # type: int
LC_COLLATE = ... # type: int
LC_CTYPE = ... # type: int
LC_MESSAGES = ... # type: int
LC_MONETARY = ... # type: int
LC_NUMERIC = ... # type: int
LC_TIME = ... # type: int
MON_1 = ... # type: int
MON_10 = ... # type: int
MON_11 = ... # type: int
MON_12 = ... # type: int
MON_2 = ... # type: int
MON_3 = ... # type: int
MON_4 = ... # type: int
MON_5 = ... # type: int
MON_6 = ... # type: int
MON_7 = ... # type: int
MON_8 = ... # type: int
MON_9 = ... # type: int
NOEXPR = ... # type: int
PM_STR = ... # type: int
RADIXCHAR = ... # type: int
THOUSEP = ... # type: int
T_FMT = ... # type: int
T_FMT_AMPM = ... # type: int
YESEXPR = ... # type: int
_DATE_FMT = ... # type: int
def bind_textdomain_codeset(domain, codeset): ...
def bindtextdomain(domain, dir): ...
def dcgettext(domain, msg, category): ...
def dgettext(domain, msg): ...
def gettext(msg): ...
def localeconv(): ...
def nl_langinfo(key): ...
def setlocale(category: int, locale: Iterable[str] = None) -> str: ...
def strcoll(string1, string2) -> int: ...
def strxfrm(string): ...
def textdomain(domain): ...
class Error(Exception): ...

View File

@@ -19,7 +19,7 @@ def concat(*args, **kwargs) -> Any: ...
def contains(*args, **kwargs) -> bool: ...
def countOf(*args, **kwargs) -> long: ...
def countOf(*args, **kwargs) -> int: ...
def delitem(*args, **kwargs) -> None: ...
@@ -49,7 +49,7 @@ def imul(*args, **kwargs) -> Any: ...
def index(*args, **kwargs) -> Any: ...
def indexOf(*args, **kwargs) -> long: ...
def indexOf(*args, **kwargs) -> int: ...
def inv(*args, **kwargs) -> Any: ...
@@ -73,7 +73,7 @@ def ixor(*args, **kwargs) -> Any: ...
def le(*args, **kwargs) -> Any: ...
def length_hint(a, *args, **kwargs) -> long: ...
def length_hint(a, *args, **kwargs) -> int: ...
def lshift(*args, **kwargs) -> Any: ...

12
builtins/3/_random.pyi Normal file
View File

@@ -0,0 +1,12 @@
# Stubs for _random
# NOTE: These are incomplete!
from typing import Any
class Random:
def seed(self, x: Any = None) -> None: ...
def getstate(self) -> tuple: ...
def setstate(self, state: tuple) -> None: ...
def random(self) -> float: ...
def getrandbits(self, k: int) -> int: ...

View File

@@ -12,7 +12,7 @@ def _get_traces() -> Any:
def clear_traces() -> None: ...
def get_traceback_limit() -> long: ...
def get_traceback_limit() -> int: ...
def get_traced_memory() -> tuple: ...

50
builtins/3/array.pyi Normal file
View File

@@ -0,0 +1,50 @@
# Stubs for array
# Based on http://docs.python.org/3.2/library/array.html
from typing import Any, Iterable, Tuple, List, Iterator, BinaryIO, overload
typecodes = ''
class array:
def __init__(self, typecode: str,
initializer: Iterable[Any] = None) -> None:
typecode = ''
itemsize = 0
def append(self, x: Any) -> None: ...
def buffer_info(self) -> Tuple[int, int]: ...
def byteswap(self) -> None: ...
def count(self, x: Any) -> int: ...
def extend(self, iterable: Iterable[Any]) -> None: ...
def frombytes(self, s: bytes) -> None: ...
def fromfile(self, f: BinaryIO, n: int) -> None: ...
def fromlist(self, list: List[Any]) -> None: ...
def fromstring(self, s: bytes) -> None: ...
def fromunicode(self, s: str) -> None: ...
def index(self, x: Any) -> int: ...
def insert(self, i: int, x: Any) -> None: ...
def pop(self, i: int = -1) -> Any: ...
def remove(self, x: Any) -> None: ...
def reverse(self) -> None: ...
def tobytes(self) -> bytes: ...
def tofile(self, f: BinaryIO) -> None: ...
def tolist(self) -> List[Any]: ...
def tostring(self) -> bytes: ...
def tounicode(self) -> str: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[Any]: ...
def __str__(self) -> str: ...
def __hash__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> Any: ...
@overload
def __getitem__(self, s: slice) -> 'array': ...
def __setitem__(self, i: int, o: Any) -> None: ...
def __delitem__(self, i: int) -> None: ...
def __add__(self, x: 'array') -> 'array': ...
def __mul__(self, n: int) -> 'array': ...
def __contains__(self, o: object) -> bool: ...

26
builtins/3/binascii.pyi Normal file
View File

@@ -0,0 +1,26 @@
# Stubs for binascii
# Based on http://docs.python.org/3.2/library/binascii.html
import typing
def a2b_uu(string: bytes) -> bytes: ...
def b2a_uu(data: bytes) -> bytes: ...
def a2b_base64(string: bytes) -> bytes: ...
def b2a_base64(data: bytes) -> bytes: ...
def a2b_qp(string: bytes, header: bool = False) -> bytes: ...
def b2a_qp(data: bytes, quotetabs: bool = False, istext: bool = True,
header: bool = False) -> bytes: ...
def a2b_hqx(string: bytes) -> bytes: ...
def rledecode_hqx(data: bytes) -> bytes: ...
def rlecode_hqx(data: bytes) -> bytes: ...
def b2a_hqx(data: bytes) -> bytes: ...
def crc_hqx(data: bytes, crc: int) -> int: ...
def crc32(data: bytes, crc: int = None) -> int: ...
def b2a_hex(data: bytes) -> bytes: ...
def hexlify(data: bytes) -> bytes: ...
def a2b_hex(hexstr: bytes) -> bytes: ...
def unhexlify(hexlify: bytes) -> bytes: ...
class Error(Exception): ...
class Incomplete(Exception): ...

0
builtins/3/bz2.pyi Normal file
View File

221
builtins/3/datetime.pyi Normal file
View File

@@ -0,0 +1,221 @@
# Stubs for datetime
# NOTE: These are incomplete!
from typing import Optional, SupportsAbs, Tuple, Union, overload
MINYEAR = 0
MAXYEAR = 0
class tzinfo:
def tzname(self, dt: Optional[datetime]) -> str: ...
def utcoffset(self, dt: Optional[datetime]) -> int: ...
def dst(self, dt: Optional[datetime]) -> int: ...
def fromutc(self, dt: datetime) -> datetime: ...
class timezone(tzinfo):
utc = ... # type: tzinfo
min = ... # type: tzinfo
max = ... # type: tzinfo
def __init__(self, offset: timedelta, name: str = '') -> None: ...
def __hash__(self) -> int: ...
_tzinfo = tzinfo
_timezone = timezone
class date:
min = ... # type: date
max = ... # type: date
resolution = ... # type: timedelta
def __init__(self, year: int, month: int = None, day: int = None) -> None: ...
@classmethod
def fromtimestamp(cls, t: float) -> date: ...
@classmethod
def today(cls) -> date: ...
@classmethod
def fromordinal(cls, n: int) -> date: ...
@property
def year(self) -> int: ...
@property
def month(self) -> int: ...
@property
def day(self) -> int: ...
def ctime(self) -> str: ...
def strftime(self, fmt: str) -> str: ...
def __format__(self, fmt: str) -> str: ...
def isoformat(self) -> str: ...
def timetuple(self) -> tuple: ... # TODO return type
def toordinal(self) -> int: ...
def replace(self, year: int = None, month: int = None, day: int = None) -> date: ...
def __le__(self, other: date) -> bool: ...
def __lt__(self, other: date) -> bool: ...
def __ge__(self, other: date) -> bool: ...
def __gt__(self, other: date) -> bool: ...
def __add__(self, other: timedelta) -> date: ...
@overload
def __sub__(self, other: timedelta) -> date: ...
@overload
def __sub__(self, other: date) -> timedelta: ...
def __hash__(self) -> int: ...
def weekday(self) -> int: ...
def isoweekday(self) -> int: ...
def isocalendar(self) -> Tuple[int, int, int]: ...
class time:
min = ... # type: time
max = ... # type: time
resolution = ... # type: timedelta
def __init__(self, hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0,
tzinfo: tzinfo = None) -> None: ...
@property
def hour(self) -> int: ...
@property
def minute(self) -> int: ...
@property
def second(self) -> int: ...
@property
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> _tzinfo: ...
def __le__(self, other: time) -> bool: ...
def __lt__(self, other: time) -> bool: ...
def __ge__(self, other: time) -> bool: ...
def __gt__(self, other: time) -> bool: ...
def __hash__(self) -> int: ...
def isoformat(self) -> str: ...
def strftime(self, fmt: str) -> str: ...
def __format__(self, fmt: str) -> str: ...
def utcoffset(self) -> Optional[int]: ...
def tzname(self) -> Optional[str]: ...
def dst(self) -> Optional[int]: ...
def replace(self, hour: int = None, minute: int = None, second: int = None,
microsecond: int = None, tzinfo: Union[_tzinfo, bool] = True) -> time: ...
_date = date
_time = time
class timedelta(SupportsAbs[timedelta]):
min = ... # type: timedelta
max = ... # type: timedelta
resolution = ... # type: timedelta
def __init__(self, days: int = 0, seconds: int = 0, microseconds: int = 0,
milliseconds: int = 0, minutes: int = 0, hours: int = 0,
weeks: int = 0) -> None: ...
@property
def days(self) -> int: ...
@property
def seconds(self) -> int: ...
@property
def microseconds(self) -> int: ...
def total_seconds(self) -> float: ...
def __add__(self, other: timedelta) -> timedelta: ...
def __radd__(self, other: timedelta) -> timedelta: ...
def __sub__(self, other: timedelta) -> timedelta: ...
def __rsub(self, other: timedelta) -> timedelta: ...
def __neg__(self) -> timedelta: ...
def __pos__(self) -> timedelta: ...
def __abs__(self) -> timedelta: ...
def __mul__(self, other: float) -> timedelta: ...
def __rmul__(self, other: float) -> timedelta: ...
@overload
def __floordiv__(self, other: timedelta) -> int: ...
@overload
def __floordiv__(self, other: int) -> timedelta: ...
@overload
def __truediv__(self, other: timedelta) -> float: ...
@overload
def __truediv__(self, other: float) -> timedelta: ...
def __mod__(self, other: timedelta) -> timedelta: ...
def __divmod__(self, other: timedelta) -> Tuple[int, timedelta]: ...
def __le__(self, other: timedelta) -> bool: ...
def __lt__(self, other: timedelta) -> bool: ...
def __ge__(self, other: timedelta) -> bool: ...
def __gt__(self, other: timedelta) -> bool: ...
def __hash__(self) -> int: ...
class datetime:
# TODO: Is a subclass of date, but this would make some types incompatible.
min = ... # type: datetime
max = ... # type: datetime
resolution = ... # type: timedelta
def __init__(self, year: int, month: int = None, day: int = None, hour: int = None,
minute: int = None, second: int = None, microsecond: int = None,
tzinfo: tzinfo = None) -> None: ...
@property
def year(self) -> int: ...
@property
def month(self) -> int: ...
@property
def day(self) -> int: ...
@property
def hour(self) -> int: ...
@property
def minute(self) -> int: ...
@property
def second(self) -> int: ...
@property
def microsecond(self) -> int: ...
@property
def tzinfo(self) -> _tzinfo: ...
@classmethod
def fromtimestamp(cls, t: float, tz: timezone = None) -> datetime: ...
@classmethod
def utcfromtimestamp(cls, t: float) -> datetime: ...
@classmethod
def today(cls) -> datetime: ...
@classmethod
def fromordinal(cls, n: int) -> datetime: ...
@classmethod
def now(cls, tz: timezone = None) -> datetime: ...
@classmethod
def utcnow(cls) -> datetime: ...
@classmethod
def combine(cls, date: date, time: time) -> datetime: ...
def strftime(self, fmt: str) -> str: ...
def __format__(self, fmt: str) -> str: ...
def toordinal(self) -> int: ...
def timetuple(self) -> tuple: ... # TODO return type
def timestamp(self) -> float: ...
def utctimetuple(self) -> tuple: ... # TODO return type
def date(self) -> _date: ...
def time(self) -> _time: ...
def timetz(self) -> _time: ...
def replace(self, year: int = None, month: int = None, day: int = None, hour: int = None,
minute: int = None, second: int = None, microsecond: int = None, tzinfo:
Union[_tzinfo, bool] = True) -> datetime: ...
def astimezone(self, tz: timezone = None) -> datetime: ...
def ctime(self) -> str: ...
def isoformat(self, sep: str = 'T') -> str: ...
@classmethod
def strptime(cls, date_string: str, format: str) -> datetime: ...
def utcoffset(self) -> Optional[int]: ...
def tzname(self) -> Optional[str]: ...
def dst(self) -> Optional[int]: ...
def __le__(self, other: datetime) -> bool: ...
def __lt__(self, other: datetime) -> bool: ...
def __ge__(self, other: datetime) -> bool: ...
def __gt__(self, other: datetime) -> bool: ...
def __add__(self, other: timedelta) -> datetime: ...
@overload
def __sub__(self, other: datetime) -> timedelta: ...
@overload
def __sub__(self, other: timedelta) -> datetime: ...
def __hash__(self) -> int: ...
def weekday(self) -> int: ...
def isoweekday(self) -> int: ...
def isocalendar(self) -> Tuple[int, int, int]: ...

132
builtins/3/errno.pyi Normal file
View File

@@ -0,0 +1,132 @@
# Stubs for errno
# Based on http://docs.python.org/3.2/library/errno.html
from typing import Dict
errorcode = ... # type: Dict[int, str]
# TODO some of the names below are platform specific
EPERM = 0
ENOENT = 0
ESRCH = 0
EINTR = 0
EIO = 0
ENXIO = 0
E2BIG = 0
ENOEXEC = 0
EBADF = 0
ECHILD = 0
EAGAIN = 0
ENOMEM = 0
EACCES = 0
EFAULT = 0
ENOTBLK = 0
EBUSY = 0
EEXIST = 0
EXDEV = 0
ENODEV = 0
ENOTDIR = 0
EISDIR = 0
EINVAL = 0
ENFILE = 0
EMFILE = 0
ENOTTY = 0
ETXTBSY = 0
EFBIG = 0
ENOSPC = 0
ESPIPE = 0
EROFS = 0
EMLINK = 0
EPIPE = 0
EDOM = 0
ERANGE = 0
EDEADLK = 0
ENAMETOOLONG = 0
ENOLCK = 0
ENOSYS = 0
ENOTEMPTY = 0
ELOOP = 0
EWOULDBLOCK = 0
ENOMSG = 0
EIDRM = 0
ECHRNG = 0
EL2NSYNC = 0
EL3HLT = 0
EL3RST = 0
ELNRNG = 0
EUNATCH = 0
ENOCSI = 0
EL2HLT = 0
EBADE = 0
EBADR = 0
EXFULL = 0
ENOANO = 0
EBADRQC = 0
EBADSLT = 0
EDEADLOCK = 0
EBFONT = 0
ENOSTR = 0
ENODATA = 0
ETIME = 0
ENOSR = 0
ENONET = 0
ENOPKG = 0
EREMOTE = 0
ENOLINK = 0
EADV = 0
ESRMNT = 0
ECOMM = 0
EPROTO = 0
EMULTIHOP = 0
EDOTDOT = 0
EBADMSG = 0
EOVERFLOW = 0
ENOTUNIQ = 0
EBADFD = 0
EREMCHG = 0
ELIBACC = 0
ELIBBAD = 0
ELIBSCN = 0
ELIBMAX = 0
ELIBEXEC = 0
EILSEQ = 0
ERESTART = 0
ESTRPIPE = 0
EUSERS = 0
ENOTSOCK = 0
EDESTADDRREQ = 0
EMSGSIZE = 0
EPROTOTYPE = 0
ENOPROTOOPT = 0
EPROTONOSUPPORT = 0
ESOCKTNOSUPPORT = 0
EOPNOTSUPP = 0
EPFNOSUPPORT = 0
EAFNOSUPPORT = 0
EADDRINUSE = 0
EADDRNOTAVAIL = 0
ENETDOWN = 0
ENETUNREACH = 0
ENETRESET = 0
ECONNABORTED = 0
ECONNRESET = 0
ENOBUFS = 0
EISCONN = 0
ENOTCONN = 0
ESHUTDOWN = 0
ETOOMANYREFS = 0
ETIMEDOUT = 0
ECONNREFUSED = 0
EHOSTDOWN = 0
EHOSTUNREACH = 0
EALREADY = 0
EINPROGRESS = 0
ESTALE = 0
EUCLEAN = 0
ENOTNAM = 0
ENAVAIL = 0
EISNAM = 0
EREMOTEIO = 0
EDQUOT = 0

11
builtins/3/fcntl.pyi Normal file
View File

@@ -0,0 +1,11 @@
# Stubs for fcntl
# NOTE: These are incomplete!
import typing
FD_CLOEXEC = 0
F_GETFD = 0
F_SETFD = 0
def fcntl(fd: int, op: int, arg: int = 0) -> int: ...

10
builtins/3/gc.pyi Normal file
View File

@@ -0,0 +1,10 @@
# Stubs for gc
# NOTE: These are incomplete!
import typing
def collect(generation: int = -1) -> int: ...
def disable() -> None: ...
def enable() -> None: ...
def isenabled() -> bool: ...

13
builtins/3/grp.pyi Normal file
View File

@@ -0,0 +1,13 @@
from typing import List
# TODO group database entry object type
class struct_group:
gr_name = ''
gr_passwd = ''
gr_gid = 0
gr_mem = ... # type: List[str]
def getgrgid(gid: int) -> struct_group: ...
def getgrnam(name: str) -> struct_group: ...
def getgrall() -> List[struct_group]: ...

10
builtins/3/imp.pyi Normal file
View File

@@ -0,0 +1,10 @@
# Stubs for imp
# NOTE: These are incomplete!
from typing import TypeVar
_T = TypeVar('_T')
def cache_from_source(path: str, debug_override: bool = None) -> str: ...
def reload(module: _T) -> _T: ... # TODO imprecise signature

57
builtins/3/itertools.pyi Normal file
View File

@@ -0,0 +1,57 @@
# Stubs for itertools
# Based on http://docs.python.org/3.2/library/itertools.html
from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple,
Union, Sequence)
_T = TypeVar('_T')
_S = TypeVar('_S')
def count(start: int = 0,
step: int = 1) -> Iterator[int]: ... # more general types?
def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def repeat(object: _T) -> Iterator[_T]: ...
@overload
def repeat(object: _T, times: int) -> Iterator[_T]: ...
def accumulate(iterable: Iterable[_T]) -> Iterator[_T]: ...
def chain(*iterables: Iterable[_T]) -> Iterator[_T]: ...
# TODO chain.from_Iterable
def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ...
def dropwhile(predicate: Callable[[_T], Any],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def filterfalse(predicate: Callable[[_T], Any],
iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def groupby(iterable: Iterable[_T]) -> Iterator[Tuple[_T, Iterator[_T]]]: ...
@overload
def groupby(iterable: Iterable[_T],
key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ...
@overload
def islice(iterable: Iterable[_T], stop: int) -> Iterator[_T]: ...
@overload
def islice(iterable: Iterable[_T], start: int, stop: int,
step: int = 1) -> Iterator[_T]: ...
def starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: ...
def takewhile(predicate: Callable[[_T], Any],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def tee(iterable: Iterable[Any], n: int = 2) -> Iterator[Any]: ...
def zip_longest(*p: Iterable[Any],
fillvalue: Any = None) -> Iterator[Any]: ...
# TODO: Return type should be Iterator[Tuple[..]], but unknown tuple shape.
# Iterator[Sequence[_T]] loses this type information.
def product(*p: Iterable[_T], repeat: int = 1) -> Iterator[Sequence[_T]]: ...
def permutations(iterable: Iterable[_T],
r: Union[int, None] = None) -> Iterator[Sequence[_T]]: ...
def combinations(iterable: Iterable[_T],
r: int) -> Iterable[Sequence[_T]]: ...
def combinations_with_replacement(iterable: Iterable[_T],
r: int) -> Iterable[Sequence[_T]]: ...

53
builtins/3/math.pyi Normal file
View File

@@ -0,0 +1,53 @@
# Stubs for math
# Ron Murawski <ron@horizonchess.com>
# based on: http://docs.python.org/3.2/library/math.html
from typing import overload, Tuple, Iterable
# ----- variables and constants -----
e = 0.0
pi = 0.0
# ----- functions -----
def ceil(x: float) -> int: ...
def copysign(x: float, y: float) -> float: ...
def fabs(x: float) -> float: ...
def factorial(x: int) -> int: ...
def floor(x: float) -> int: ...
def fmod(x: float, y: float) -> float: ...
def frexp(x: float) -> Tuple[float, int]: ...
def fsum(iterable: Iterable) -> float: ...
def isfinite(x: float) -> bool: ...
def isinf(x: float) -> bool: ...
def isnan(x: float) -> bool: ...
def ldexp(x: float, i: int) -> float: ...
def modf(x: float) -> Tuple[float, float]: ...
def trunc(x: float) -> float: ...
def exp(x: float) -> float: ...
def expm1(x: float) -> float: ...
def log(x: float, base: float = ...) -> float: ...
def log1p(x: float) -> float: ...
def log10(x: float) -> float: ...
def pow(x: float, y: float) -> float: ...
def sqrt(x: float) -> float: ...
def acos(x: float) -> float: ...
def asin(x: float) -> float: ...
def atan(x: float) -> float: ...
def atan2(y: float, x: float) -> float: ...
def cos(x: float) -> float: ...
def hypot(x: float, y: float) -> float: ...
def sin(x: float) -> float: ...
def tan(x: float) -> float: ...
def degrees(x: float) -> float: ...
def radians(x: float) -> float: ...
def acosh(x: float) -> float: ...
def asinh(x: float) -> float: ...
def atanh(x: float) -> float: ...
def cosh(x: float) -> float: ...
def sinh(x: float) -> float: ...
def tanh(x: float) -> float: ...
def erf(x: object) -> float: ...
def erfc(x: object) -> float: ...
def gamma(x: object) -> float: ...
def lgamma(x: object) -> float: ...

7
builtins/3/operator.pyi Normal file
View File

@@ -0,0 +1,7 @@
# Stubs for operator
# NOTE: These are incomplete!
from typing import Any
def add(a: Any, b: Any) -> Any: ...

7
builtins/3/posix.pyi Normal file
View File

@@ -0,0 +1,7 @@
# Stubs for posix
# NOTE: These are incomplete!
import typing
from os import stat_result

18
builtins/3/pwd.pyi Normal file
View File

@@ -0,0 +1,18 @@
# Stubs for pwd
# NOTE: These are incomplete!
import typing
class struct_passwd:
# TODO use namedtuple
pw_name = ''
pw_passwd = ''
pw_uid = 0
pw_gid = 0
pw_gecos = ''
pw_dir = ''
pw_shell = ''
def getpwuid(uid: int) -> struct_passwd: ...
def getpwnam(name: str) -> struct_passwd: ...

13
builtins/3/resource.pyi Normal file
View File

@@ -0,0 +1,13 @@
# Stubs for resource
# NOTE: These are incomplete!
from typing import Tuple
RLIMIT_CORE = 0
def getrlimit(resource: int) -> Tuple[int, int]: ...
def setrlimit(resource: int, limits: Tuple[int, int]) -> None: ...
# NOTE: This is an alias of OSError in Python 3.3.
class error(Exception): ...

27
builtins/3/select.pyi Normal file
View File

@@ -0,0 +1,27 @@
# Stubs for select
# NOTE: These are incomplete!
from typing import Any, Tuple, List, Sequence
class error(Exception): ...
POLLIN = 0
POLLPRI = 0
POLLOUT = 0
POLLERR = 0
POLLHUP = 0
POLLNVAL = 0
class poll:
def __init__(self) -> None: ...
def register(self, fd: Any,
eventmask: int = POLLIN|POLLPRI|POLLOUT) -> None: ...
def modify(self, fd: Any, eventmask: int) -> None: ...
def unregister(self, fd: Any) -> None: ...
def poll(self, timeout: int = None) -> List[Tuple[int, int]]: ...
def select(rlist: Sequence, wlist: Sequence, xlist: Sequence,
timeout: float = None) -> Tuple[List[int],
List[int],
List[int]]: ...

View File

@@ -1,94 +1,51 @@
"""Stub file for the 'signal' module."""
# This is an autogenerated file. It serves as a starting point
# for a more precise manual annotation of this module.
# Feel free to edit the source below, but remove this header when you do.
# Stubs for signal
from typing import Any, List, Tuple, Dict, Generic
# Based on http://docs.python.org/3.2/library/signal.html
ITIMER_PROF = ... # type: long
ITIMER_REAL = ... # type: long
ITIMER_VIRTUAL = ... # type: long
ItimerError = ... # type: object
NSIG = ... # type: long
SIGABRT = ... # type: long
SIGALRM = ... # type: long
SIGBUS = ... # type: long
SIGCHLD = ... # type: long
SIGCLD = ... # type: long
SIGCONT = ... # type: long
SIGFPE = ... # type: long
SIGHUP = ... # type: long
SIGILL = ... # type: long
SIGINT = ... # type: long
SIGIO = ... # type: long
SIGIOT = ... # type: long
SIGKILL = ... # type: long
SIGPIPE = ... # type: long
SIGPOLL = ... # type: long
SIGPROF = ... # type: long
SIGPWR = ... # type: long
SIGQUIT = ... # type: long
SIGRTMAX = ... # type: long
SIGRTMIN = ... # type: long
SIGSEGV = ... # type: long
SIGSTOP = ... # type: long
SIGSYS = ... # type: long
SIGTERM = ... # type: long
SIGTRAP = ... # type: long
SIGTSTP = ... # type: long
SIGTTIN = ... # type: long
SIGTTOU = ... # type: long
SIGURG = ... # type: long
SIGUSR1 = ... # type: long
SIGUSR2 = ... # type: long
SIGVTALRM = ... # type: long
SIGWINCH = ... # type: long
SIGXCPU = ... # type: long
SIGXFSZ = ... # type: long
SIG_DFL = ... # type: long
SIG_IGN = ... # type: long
from typing import Any, overload, Callable
def alarm(a: int) -> long: ...
SIG_DFL = 0
SIG_IGN = 0
def default_int_handler(*args, **kwargs) -> Any:
raise KeyboardInterrupt()
# TODO more SIG* constants (these should be platform specific?)
SIGHUP = 0
SIGINT = 0
SIGQUIT = 0
SIGABRT = 0
SIGKILL = 0
SIGALRM = 0
SIGTERM = 0
def getitimer(a: int) -> tuple: ...
SIGUSR1 = 0
SIGUSR2 = 0
SIGCONT = 0
SIGSTOP = 0
def getsignal(a: int) -> None:
raise ValueError()
SIGPOLL = 0
SIGVTALRM = 0
def pause() -> None: ...
CTRL_C_EVENT = 0 # Windows
CTRL_BREAK_EVENT = 0 # Windows
def pthread_kill(a: int, b: int) -> None:
raise OSError()
NSIG = 0
ITIMER_REAL = 0
ITIMER_VIRTUAL = 0
ITIMER_PROF = 0
def pthread_sigmask(a: int, b) -> Any:
raise OSError()
class ItimerError(IOError): ...
def set_wakeup_fd(a: int) -> long:
raise ValueError()
def alarm(time: int) -> int: ... # Unix
def getsignal(signalnum: int) -> Any: ...
def pause() -> None: ... # Unix
#def setitimer(which: int, seconds: float,
# internval: float = None) -> Tuple[float, float]: ... # Unix
#def getitimer(int which): ... # Unix
def set_wakeup_fd(fd: int) -> None: ...
def siginterrupt(signalnum: int, flag: bool) -> None: ...
def setitimer(a: int, b: float, *args, **kwargs) -> tuple: ...
def siginterrupt(a: int, b: int) -> None:
raise OSError()
raise ValueError()
def signal(a: int, b) -> None:
raise OSError()
raise TypeError()
raise ValueError()
def sigpending() -> Any:
raise OSError()
def sigtimedwait(a, b) -> Any:
raise OSError()
raise ValueError()
def sigwait(a) -> long:
raise OSError()
def sigwaitinfo(a) -> tuple:
raise OSError()
@overload
def signal(signalnum: int, handler: int) -> Any: ...
@overload
def signal(signalnum: int,
handler: Callable[[int, Any], None]) -> Any:
... # TODO frame object type

154
builtins/3/sys.pyi Normal file
View File

@@ -0,0 +1,154 @@
# Stubs for sys
# Ron Murawski <ron@horizonchess.com>
# based on http://docs.python.org/3.2/library/sys.html
from typing import (
List, Sequence, Any, Dict, Tuple, TextIO, overload, Optional
)
from types import TracebackType
# ----- sys variables -----
abiflags = ''
argv = ... # type: List[str]
byteorder = ''
builtin_module_names = ... # type: Sequence[str] # actually a tuple of strings
copyright = ''
#dllhandle = 0 # Windows only
dont_write_bytecode = False
__displayhook__ = ... # type: Any # contains the original value of displayhook
__excepthook__ = ... # type: Any # contains the original value of excepthook
exec_prefix = ''
executable = ''
float_repr_style = ''
hexversion = 0 # this is a 32-bit int
last_type = ... # type: Any
last_value = ... # type: Any
last_traceback = ... # type: Any
maxsize = 0
maxunicode = 0
meta_path = ... # type: List[Any]
modules = ... # type: Dict[str, Any]
path = ... # type: List[str]
path_hooks = ... # type: List[Any] # TODO precise type; function, path to finder
path_importer_cache = ... # type: Dict[str, Any] # TODO precise type
platform = ''
prefix = ''
ps1 = ''
ps2 = ''
stdin = ... # type: TextIO
stdout = ... # type: TextIO
stderr = ... # type: TextIO
__stdin__ = ... # type: TextIO
__stdout__ = ... # type: TextIO
__stderr__ = ... # type: TextIO
# deprecated and removed in Python 3.3:
subversion = ... # type: Tuple[str, str, str]
tracebacklimit = 0
version = ''
api_version = 0
warnoptions = ... # type: Any
# Each entry is a tuple of the form (action, message, category, module,
# lineno)
#winver = '' # Windows only
_xoptions = ... # type: Dict[Any, Any]
flags = ... # type: _flags
class _flags:
debug = 0
division_warning = 0
inspect = 0
interactive = 0
optimize = 0
dont_write_bytecode = 0
no_user_site = 0
no_site = 0
ignore_environment = 0
verbose = 0
bytes_warning = 0
quiet = 0
hash_randomization = 0
float_info = ... # type: _float_info
class _float_info:
epsilon = 0.0 # DBL_EPSILON
dig = 0 # DBL_DIG
mant_dig = 0 # DBL_MANT_DIG
max = 0.0 # DBL_MAX
max_exp = 0 # DBL_MAX_EXP
max_10_exp = 0 # DBL_MAX_10_EXP
min = 0.0 # DBL_MIN
min_exp = 0 # DBL_MIN_EXP
min_10_exp = 0 # DBL_MIN_10_EXP
radix = 0 # FLT_RADIX
rounds = 0 # FLT_ROUNDS
hash_info = ... # type: _hash_info
class _hash_info:
width = 0 # width in bits used for hash values
modulus = 0 # prime modulus P used for numeric hash scheme
inf = 0 # hash value returned for a positive infinity
nan = 0 # hash value returned for a nan
imag = 0 # multiplier used for the imaginary part of a complex number
int_info = ... # type: _int_info
class _int_info:
bits_per_digit = 0 # number of bits held in each digit. Python integers
# are stored internally in
# base 2**int_info.bits_per_digit
sizeof_digit = 0 # size in bytes of C type used to represent a digit
class _version_info(Tuple[int, int, int, str, int]):
major = 0
minor = 0
micro = 0
releaselevel = ''
serial = 0
version_info = ... # type: _version_info
# ----- sys function stubs -----
def call_tracing(fn: Any, args: Any) -> object: ...
def _clear_type_cache() -> None: ...
def _current_frames() -> Dict[int, Any]: ...
def displayhook(value: Optional[int]) -> None: ...
def excepthook(type_: type, value: BaseException,
traceback: TracebackType) -> None: ...
def exc_info() -> Tuple[type, BaseException, TracebackType]: ...
def exit(arg: int = None) -> None: ...
def getcheckinterval() -> int: ... # deprecated
def getdefaultencoding() -> str: ...
def getdlopenflags() -> int: ... # Unix only
def getfilesystemencoding() -> str: ... # cannot return None
def getrefcount(object) -> int: ...
def getrecursionlimit() -> int: ...
@overload
def getsizeof(obj: object) -> int: ...
@overload
def getsizeof(obj: object, default: int) -> int: ...
def getswitchinterval() -> float: ...
@overload
def _getframe() -> Any: ...
@overload
def _getframe(depth: int) -> Any: ...
def getprofile() -> Any: ... # TODO return type
def gettrace() -> Any: ... # TODO return
def getwindowsversion() -> Any: ... # Windows only, TODO return type
def intern(string: str) -> str: ...
def setcheckinterval(interval: int) -> None: ... # deprecated
def setdlopenflags(n: int) -> None: ... # Linux only
def setprofile(profilefunc: Any) -> None: ... # TODO type
def setrecursionlimit(limit: int) -> None: ...
def setswitchinterval(interval: float) -> None: ...
def settrace(tracefunc: Any) -> None: ... # TODO type
# Trace functions should have three arguments: frame, event, and arg. frame
# is the current stack frame. event is a string: 'call', 'line', 'return',
# 'exception', 'c_call', 'c_return', or 'c_exception'. arg depends on the
# event type.
def settscdump(on_flag: bool) -> None: ...
def gettotalrefcount() -> int: ... # Debug builds only

View File

@@ -1,50 +1,64 @@
"""Stub file for the 'time' module."""
# This is an autogenerated file. It serves as a starting point
# for a more precise manual annotation of this module.
# Feel free to edit the source below, but remove this header when you do.
# Stubs for time
# Ron Murawski <ron@horizonchess.com>
from typing import Any, List, Tuple, Dict, Generic
# based on: http://docs.python.org/3.2/library/time.html#module-time
# see: http://nullege.com/codes/search?cq=time
def asctime(*args, **kwargs) -> unicode: ...
from typing import Tuple, Union
# ----- variables and constants -----
accept2dyear = False
altzone = 0
daylight = 0
timezone = 0
tzname = ... # type: Tuple[str, str]
# ----- classes/methods -----
class struct_time:
# this is supposed to be a namedtuple object
# namedtuple is not yet implemented (see file: mypy/stubs/collections.py)
# see: http://docs.python.org/3.2/library/time.html#time.struct_time
# see: http://nullege.com/codes/search/time.struct_time
# TODO: namedtuple() object problem
#namedtuple __init__(self, int, int, int, int, int, int, int, int, int):
# ...
tm_year = 0
tm_mon = 0
tm_mday = 0
tm_hour = 0
tm_min = 0
tm_sec = 0
tm_wday = 0
tm_yday = 0
tm_isdst = 0
# ----- functions -----
def asctime(t: Union[Tuple[int, int, int, int, int, int, int, int, int],
struct_time,
None] = None) -> str: ... # return current time
def clock() -> float: ...
def clock_getres(a: int) -> float:
raise IOError()
def ctime(secs: Union[float, None] = None) -> str: ... # return current time
def clock_gettime(a: int) -> float:
raise IOError()
def gmtime(secs: Union[float, None] = None) -> struct_time: ... # return current time
def clock_settime(a: int, b) -> None:
raise IOError()
def localtime(secs: Union[float, None] = None) -> struct_time: ... # return current time
def ctime(*args, **kwargs) -> unicode: ...
def mktime(t: Union[Tuple[int, int, int, int, int,
int, int, int, int],
struct_time]) -> float: ...
def get_clock_info(a: str) -> Any:
raise ValueError()
def sleep(secs: Union[int, float]) -> None: ...
def gmtime(*args, **kwargs) -> tuple:
raise OSError()
def localtime(*args, **kwargs) -> tuple: ...
def mktime(*args, **kwargs) -> float:
raise OverflowError()
def monotonic() -> float: ...
def perf_counter() -> float: ...
def process_time() -> float: ...
def sleep(a: float) -> None:
raise ValueError()
def strftime(a: str, *args, **kwargs) -> unicode:
raise MemoryError()
def strptime(*args, **kwargs) -> Any: ...
def strftime(format: str, t: Union[Tuple[int, int, int, int, int,
int, int, int, int],
struct_time,
None] = None) -> str: ... # return current time
def strptime(string: str,
format: str = "%a %b %d %H:%M:%S %Y") -> struct_time: ...
def time() -> float: ...
def tzset() -> None: ...
def tzset() -> None: ... # Unix only

View File

@@ -0,0 +1,37 @@
# Stubs for unicodedata (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
ucd_3_2_0 = ... # type: Any
ucnhash_CAPI = ... # type: Any
unidata_version = ... # type: str
def bidirectional(unichr): ...
def category(unichr): ...
def combining(unichr): ...
def decimal(chr, default=...): ...
def decomposition(unichr): ...
def digit(chr, default=...): ...
def east_asian_width(unichr): ...
def lookup(name): ...
def mirrored(unichr): ...
def name(chr, default=...): ...
def normalize(form, unistr): ...
def numeric(chr, default=...): ...
class UCD:
unidata_version = ... # type: Any
def bidirectional(self, unichr): ...
def category(self, unichr): ...
def combining(self, unichr): ...
def decimal(self, chr, default=...): ...
def decomposition(self, unichr): ...
def digit(self, chr, default=...): ...
def east_asian_width(self, unichr): ...
def lookup(self, name): ...
def mirrored(self, unichr): ...
def name(self, chr, default=...): ...
def normalize(self, form, unistr): ...
def numeric(self, chr, default=...): ...

32
builtins/3/zlib.pyi Normal file
View File

@@ -0,0 +1,32 @@
# Stubs for zlib (Python 3.4)
#
# NOTE: This stub was automatically generated by stubgen.
# TODO: Compress and Decompress classes are not published by the module.
DEFLATED = ... # type: int
DEF_BUF_SIZE = ... # type: int
DEF_MEM_LEVEL = ... # type: int
MAX_WBITS = ... # type: int
ZLIB_RUNTIME_VERSION = ... # type: str
ZLIB_VERSION = ... # type: str
Z_BEST_COMPRESSION = ... # type: int
Z_BEST_SPEED = ... # type: int
Z_DEFAULT_COMPRESSION = ... # type: int
Z_DEFAULT_STRATEGY = ... # type: int
Z_FILTERED = ... # type: int
Z_FINISH = ... # type: int
Z_FULL_FLUSH = ... # type: int
Z_HUFFMAN_ONLY = ... # type: int
Z_NO_FLUSH = ... # type: int
Z_SYNC_FLUSH = ... # type: int
def adler32(data, value=...) -> int: ...
def compress(data, level: int = 6): ...
def compressobj(level=..., method=..., wbits=..., memlevel=...,
strategy=..., zdict=...): ...
def crc32(data, value=...) -> int: ...
def decompress(data, wbits=..., bufsize=...): ...
def decompressobj(wbits=..., zdict=...): ...
class error(Exception): ...