Merge branch 'mypy'

This commit is contained in:
Matthias Kramm
2015-09-30 11:42:15 -07:00
432 changed files with 22360 additions and 776 deletions

35
LICENSE
View File

@@ -1,3 +1,7 @@
typeshed is licensed under the terms of the Apache license, reproduced below.
= = = = =
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@@ -200,3 +204,34 @@ Apache License
See the License for the specific language governing permissions and
limitations under the License.
= = = = =
Parts of typeshed are licensed under different licenses (like the MIT
License), reproduced below.
= = = = =
The MIT License
Copyright (c) 2015 Jukka Lehtosalo and contributors
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
= = = = =

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

View File

@@ -47,7 +47,7 @@ class date(object):
def ctime(self) -> str: ...
def strftime(self, fmt: str) -> str: ...
def __format__(self, fmt: Union[str, unicode]) -> str: ...
def __format__(self, fmt: str) -> str: ...
def isoformat(self) -> str: ...
def timetuple(self) -> tuple: ... # TODO return type
def toordinal(self) -> int: ...
@@ -190,8 +190,7 @@ class datetime(object):
def toordinal(self) -> int: ...
def timetuple(self) -> tuple: ... # TODO return type
def timestamp(self) -> float: ...
def utctimetuple(self) -> tuple: # TODO return type
raise OverflowError()
def utctimetuple(self) -> tuple: ... # TODO return type
def date(self) -> _date: ...
def time(self) -> _time: ...
def timetz(self) -> _time: ...

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

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

@@ -0,0 +1,29 @@
# Stubs for Queue (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class Empty(Exception): ...
class Full(Exception): ...
class Queue:
maxsize = ... # type: Any
mutex = ... # type: Any
not_empty = ... # type: Any
not_full = ... # type: Any
all_tasks_done = ... # type: Any
unfinished_tasks = ... # type: Any
def __init__(self, maxsize: int = 0) -> None: ...
def task_done(self) -> None: ...
def join(self) -> None: ...
def qsize(self) -> int: ...
def empty(self) -> bool: ...
def full(self) -> bool: ...
def put(self, item: Any, block: bool = ..., timeout: float = None) -> None: ...
def put_nowait(self, item) -> None: ...
def get(self, block: bool = ..., timeout: float = None) -> Any: ...
def get_nowait(self) -> Any: ...
class PriorityQueue(Queue): ...
class LifoQueue(Queue): ...

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

@@ -0,0 +1,28 @@
# Stubs for StringIO (Python 2)
from typing import Any, IO, AnyStr, Iterator, Iterable, Generic
class StringIO(IO[AnyStr], Generic[AnyStr]):
closed = ... # type: bool
softspace = ... # type: int
def __init__(self, buf: AnyStr = '') -> None: ...
def __iter__(self) -> Iterator[AnyStr]: ...
def next(self) -> AnyStr: ...
def close(self) -> None: ...
def isatty(self) -> bool: ...
def seek(self, pos: int, mode: int = 0) -> None: ...
def tell(self) -> int: ...
def read(self, n: int = -1) -> AnyStr: ...
def readline(self, length: int = None) -> AnyStr: ...
def readlines(self, sizehint: int = 0) -> List[AnyStr]: ...
def truncate(self, size: int = None) -> int: ...
def write(self, s: AnyStr) -> None: ...
def writelines(self, iterable: Iterable[AnyStr]) -> None: ...
def flush(self) -> None: ...
def getvalue(self) -> AnyStr: ...
def __enter__(self) -> Any: ...
def __exit__(self, type: Any, value: Any, traceback: Any) -> Any: ...
def fileno(self) -> int: ...
def readable(self) -> bool: ...
def seekable(self) -> bool: ...
def writable(self) -> bool: ...

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

@@ -0,0 +1,11 @@
from typing import Dict, Generic, Mapping, TypeVar
_KT = TypeVar('_KT')
_VT = TypeVar('_VT')
class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
data = ... # type: Mapping[_KT, _VT]
def __init__(self, initialdata: Mapping[_KT, _VT] = None) -> None: ...
# TODO: DictMixin

View File

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

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

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

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

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

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

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

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

@@ -0,0 +1,25 @@
# Stubs for base64
# Based on http://docs.python.org/3.2/library/base64.html
from typing import IO
def b64encode(s: str, altchars: str = None) -> str: ...
def b64decode(s: str, altchars: str = None,
validate: bool = False) -> str: ...
def standard_b64encode(s: str) -> str: ...
def standard_b64decode(s: str) -> str: ...
def urlsafe_b64encode(s: str) -> str: ...
def urlsafe_b64decode(s: str) -> str: ...
def b32encode(s: str) -> str: ...
def b32decode(s: str, casefold: bool = False,
map01: str = None) -> str: ...
def b16encode(s: str) -> str: ...
def b16decode(s: str, casefold: bool = False) -> str: ...
def decode(input: IO[str], output: IO[str]) -> None: ...
def decodebytes(s: str) -> str: ...
def decodestring(s: str) -> str: ...
def encode(input: IO[str], output: IO[str]) -> None: ...
def encodebytes(s: str) -> str: ...
def encodestring(s: str) -> str: ...

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

@@ -0,0 +1,165 @@
# Stubs for codecs (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
BOM_UTF8 = ... # type: Any
BOM_LE = ... # type: Any
BOM_BE = ... # type: Any
BOM_UTF32_LE = ... # type: Any
BOM_UTF32_BE = ... # type: Any
BOM = ... # type: Any
BOM_UTF32 = ... # type: Any
BOM32_LE = ... # type: Any
BOM32_BE = ... # type: Any
BOM64_LE = ... # type: Any
BOM64_BE = ... # type: Any
class CodecInfo(tuple):
name = ... # type: Any
encode = ... # type: Any
decode = ... # type: Any
incrementalencoder = ... # type: Any
incrementaldecoder = ... # type: Any
streamwriter = ... # type: Any
streamreader = ... # type: Any
def __new__(cls, encode, decode, streamreader=None, streamwriter=None, incrementalencoder=None, incrementaldecoder=None, name=None): ...
class Codec:
def encode(self, input, errors=''): ...
def decode(self, input, errors=''): ...
class IncrementalEncoder:
errors = ... # type: Any
buffer = ... # type: Any
def __init__(self, errors=''): ...
def encode(self, input, final=False): ...
def reset(self): ...
def getstate(self): ...
def setstate(self, state): ...
class BufferedIncrementalEncoder(IncrementalEncoder):
buffer = ... # type: Any
def __init__(self, errors=''): ...
def encode(self, input, final=False): ...
def reset(self): ...
def getstate(self): ...
def setstate(self, state): ...
class IncrementalDecoder:
errors = ... # type: Any
def __init__(self, errors=''): ...
def decode(self, input, final=False): ...
def reset(self): ...
def getstate(self): ...
def setstate(self, state): ...
class BufferedIncrementalDecoder(IncrementalDecoder):
buffer = ... # type: Any
def __init__(self, errors=''): ...
def decode(self, input, final=False): ...
def reset(self): ...
def getstate(self): ...
def setstate(self, state): ...
class StreamWriter(Codec):
stream = ... # type: Any
errors = ... # type: Any
def __init__(self, stream, errors=''): ...
def write(self, object): ...
def writelines(self, list): ...
def reset(self): ...
def seek(self, offset, whence=0): ...
def __getattr__(self, name, getattr=...): ...
def __enter__(self): ...
def __exit__(self, type, value, tb): ...
class StreamReader(Codec):
stream = ... # type: Any
errors = ... # type: Any
bytebuffer = ... # type: Any
charbuffer = ... # type: Any
linebuffer = ... # type: Any
def __init__(self, stream, errors=''): ...
def decode(self, input, errors=''): ...
def read(self, size=-1, chars=-1, firstline=False): ...
def readline(self, size=None, keepends=True): ...
def readlines(self, sizehint=None, keepends=True): ...
def reset(self): ...
def seek(self, offset, whence=0): ...
def next(self): ...
def __iter__(self): ...
def __getattr__(self, name, getattr=...): ...
def __enter__(self): ...
def __exit__(self, type, value, tb): ...
class StreamReaderWriter:
encoding = ... # type: Any
stream = ... # type: Any
reader = ... # type: Any
writer = ... # type: Any
errors = ... # type: Any
def __init__(self, stream, Reader, Writer, errors=''): ...
def read(self, size=-1): ...
def readline(self, size=None): ...
def readlines(self, sizehint=None): ...
def next(self): ...
def __iter__(self): ...
def write(self, data): ...
def writelines(self, list): ...
def reset(self): ...
def seek(self, offset, whence=0): ...
def __getattr__(self, name, getattr=...): ...
def __enter__(self): ...
def __exit__(self, type, value, tb): ...
class StreamRecoder:
data_encoding = ... # type: Any
file_encoding = ... # type: Any
stream = ... # type: Any
encode = ... # type: Any
decode = ... # type: Any
reader = ... # type: Any
writer = ... # type: Any
errors = ... # type: Any
def __init__(self, stream, encode, decode, Reader, Writer, errors=''): ...
def read(self, size=-1): ...
def readline(self, size=None): ...
def readlines(self, sizehint=None): ...
def next(self): ...
def __iter__(self): ...
def write(self, data): ...
def writelines(self, list): ...
def reset(self): ...
def __getattr__(self, name, getattr=...): ...
def __enter__(self): ...
def __exit__(self, type, value, tb): ...
def open(filename, mode='', encoding=None, errors='', buffering=1): ...
def EncodedFile(file, data_encoding, file_encoding=None, errors=''): ...
def getencoder(encoding): ...
def getdecoder(encoding): ...
def getincrementalencoder(encoding): ...
def getincrementaldecoder(encoding): ...
def getreader(encoding): ...
def getwriter(encoding): ...
def iterencode(iterator, encoding, errors='', **kwargs): ...
def iterdecode(iterator, encoding, errors='', **kwargs): ...
strict_errors = ... # type: Any
ignore_errors = ... # type: Any
replace_errors = ... # type: Any
xmlcharrefreplace_errors = ... # type: Any
backslashreplace_errors = ... # type: Any
# Names in __all__ with no definition:
# BOM_UTF16
# BOM_UTF16_BE
# BOM_UTF16_LE
# decode
# encode
# lookup
# lookup_error
# register
# register_error

View File

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

View File

@@ -0,0 +1,7 @@
# Stubs for compileall (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None, quiet=0): ...
def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0): ...
def compile_path(skip_curdir=1, maxlevels=0, force=0, quiet=0): ...

View File

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

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

@@ -0,0 +1,10 @@
# Stubs for copy
# NOTE: These are incomplete!
from typing import TypeVar
_T = TypeVar('_T')
def deepcopy(x: _T) -> _T: ...
def copy(x: _T) -> _T: ...

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

@@ -0,0 +1,93 @@
# Stubs for csv (Python 2.7)
#
# NOTE: Based on a dynamically typed stub automatically generated by stubgen.
from abc import ABCMeta, abstractmethod
from typing import Any, Dict, Iterable, List, Sequence, Union
# Public interface of _csv.reader
class Reader(Iterable[List[str]], metaclass=ABCMeta):
dialect = ... # type: Dialect
line_num = ... # type: int
@abstractmethod
def next(self) -> List[str]: ...
_Row = Sequence[Union[str, int]]
# Public interface of _csv.writer
class Writer(metaclass=ABCMeta):
dialect = ... # type: Dialect
@abstractmethod
def writerow(self, row: _Row) -> None: ...
@abstractmethod
def writerows(self, rows: Iterable[_Row]) -> None: ...
QUOTE_ALL = ... # type: int
QUOTE_MINIMAL = ... # type: int
QUOTE_NONE = ... # type: int
QUOTE_NONNUMERIC = ... # type: int
class Error(Exception): ...
_Dialect = Union[str, Dialect]
def writer(csvfile: Any, dialect: _Dialect = ..., **fmtparams) -> Writer: ...
def reader(csvfile: Iterable[str], dialect: _Dialect = ..., **fmtparams) -> Reader: ...
def register_dialect(name, dialect=..., **fmtparams): ...
def unregister_dialect(name): ...
def get_dialect(name: str) -> Dialect: ...
def list_dialects(): ...
def field_size_limit(new_limit: int = ...) -> int: ...
class Dialect:
delimiter = ... # type: str
quotechar = ... # type: str
escapechar = ... # type: str
doublequote = ... # type: bool
skipinitialspace = ... # type: bool
lineterminator = ... # type: str
quoting = ... # type: int
def __init__(self) -> None: ...
class excel(Dialect):
pass
class excel_tab(excel):
pass
class unix_dialect(Dialect):
pass
class DictReader:
restkey = ... # type: Any
restval = ... # type: Any
reader = ... # type: Any
dialect = ... # type: _Dialect
line_num = ... # type: int
fieldnames = ... # type: Sequence[Any]
def __init__(self, f: Iterable[str], fieldnames: Sequence[Any] = None, restkey=None,
restval=None, dialect: _Dialect = '', *args, **kwds) -> None: ...
def __iter__(self): ...
def __next__(self): ...
_DictRow = Dict[Any, Union[str, int]]
class DictWriter:
fieldnames = ... # type: Any
restval = ... # type: Any
extrasaction = ... # type: Any
writer = ... # type: Any
def __init__(self, f: Any, fieldnames: Sequence[Any], restval='', extrasaction: str = ...,
dialect: _Dialect = '', *args, **kwds) -> None: ...
def writeheader(self) -> None: ...
def writerow(self, rowdict: _DictRow) -> None: ...
def writerows(self, rowdicts: Iterable[_DictRow]) -> None: ...
class Sniffer:
preferred = ... # type: Any
def __init__(self) -> None: ...
def sniff(self, sample: str, delimiters: str = None) -> Dialect: ...
def has_header(self, sample: str) -> bool: ...

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

@@ -0,0 +1,63 @@
# Stubs for difflib
# Based on https://docs.python.org/2.7/library/difflib.html
# TODO: Support unicode?
from typing import (
TypeVar, Callable, Iterable, List, NamedTuple, Sequence, Tuple, Generic
)
_T = TypeVar('_T')
class SequenceMatcher(Generic[_T]):
def __init__(self, isjunk: Callable[[_T], bool] = None,
a: Sequence[_T] = None, b: Sequence[_T] = None,
autojunk: bool = True) -> None: ...
def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ...
def set_seq1(self, a: Sequence[_T]) -> None: ...
def set_seq2(self, b: Sequence[_T]) -> None: ...
def find_longest_match(self, alo: int, ahi: int, blo: int,
bhi: int) -> Tuple[int, int, int]: ...
def get_matching_blocks(self) -> List[Tuple[int, int, int]]: ...
def get_opcodes(self) -> List[Tuple[str, int, int, int, int]]: ...
def get_grouped_opcodes(self, n: int = 3
) -> Iterable[Tuple[str, int, int, int, int]]: ...
def ratio(self) -> float: ...
def quick_ratio(self) -> float: ...
def real_quick_ratio(self) -> float: ...
def get_close_matches(word: Sequence[_T], possibilities: List[Sequence[_T]],
n: int = 3, cutoff: float = 0.6) -> List[Sequence[_T]]: ...
class Differ:
def __init__(self, linejunk: Callable[[str], bool] = None,
charjunk: Callable[[str], bool] = None) -> None: ...
def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterable[str]: ...
def IS_LINE_JUNK(str) -> bool: ...
def IS_CHARACTER_JUNK(str) -> bool: ...
def unified_diff(a: Sequence[str], b: Sequence[str], fromfile: str = '',
tofile: str = '', fromfiledate: str = '', tofiledate: str = '',
n: int = 3, lineterm: str = '\n') -> Iterable[str]: ...
def context_diff(a: Sequence[str], b: Sequence[str], fromfile: str='',
tofile: str = '', fromfiledate: str = '', tofiledate: str = '',
n: int = 3, lineterm: str = '\n') -> Iterable[str]: ...
def ndiff(a: Sequence[str], b: Sequence[str],
linejunk: Callable[[str], bool] = None,
charjunk: Callable[[str], bool] = IS_CHARACTER_JUNK
) -> Iterable[str]: ...
class HtmlDiff(object):
def __init__(self, tabsize: int = 8, wrapcolumn: int = None,
linejunk: Callable[[str], bool] = None,
charjunk: Callable[[str], bool] = IS_CHARACTER_JUNK
) -> None: ...
def make_file(self, fromlines: Sequence[str], tolines: Sequence[str],
fromdesc: str = '', todesc: str = '', context: bool = False,
numlines: int = 5) -> str: ...
def make_table(self, fromlines: Sequence[str], tolines: Sequence[str],
fromdesc: str = '', todesc: str = '', context: bool = False,
numlines: int = 5) -> str: ...
def restore(delta: Iterable[str], which: int) -> Iterable[int]: ...

View File

@@ -0,0 +1,7 @@
# Stubs for distutils (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
__revision__ = ... # type: Any

View File

@@ -0,0 +1,23 @@
# Stubs for distutils.version (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class Version:
def __init__(self, vstring=None): ...
class StrictVersion(Version):
version_re = ... # type: Any
version = ... # type: Any
prerelease = ... # type: Any
def parse(self, vstring): ...
def __cmp__(self, other): ...
class LooseVersion(Version):
component_re = ... # type: Any
def __init__(self, vstring=None): ...
vstring = ... # type: Any
version = ... # type: Any
def parse(self, vstring): ...
def __cmp__(self, other): ...

View File

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

View File

View File

View File

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

View File

@@ -0,0 +1,8 @@
# Stubs for email.mime.multipart (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from email.mime.base import MIMEBase
class MIMEMultipart(MIMEBase):
def __init__(self, _subtype='', boundary=None, _subparts=None, **_params): ...

View File

@@ -0,0 +1,8 @@
# Stubs for email.mime.nonmultipart (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from email.mime.base import MIMEBase
class MIMENonMultipart(MIMEBase):
def attach(self, payload): ...

View File

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

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

@@ -0,0 +1,6 @@
from typing import Iterable, Pattern
def fnmatch(filename: str, pattern: str) -> bool: ...
def fnmatchcase(filename: str, pattern: str) -> bool: ...
def filter(names: Iterable[str], pattern: str) -> Iterable[str]: ...
def translate(pattern: str) -> Pattern[str]: ...

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

@@ -0,0 +1,23 @@
# Stubs for functools (Python 2.7)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from abc import ABCMeta, abstractmethod
from typing import Any, Callable, Dict, Sequence
from collections import namedtuple
_AnyCallable = Callable[..., Any]
def reduce(function, iterable, initializer=None): ...
WRAPPER_ASSIGNMENTS = ... # type: Sequence[str]
WRAPPER_UPDATES = ... # type: Sequence[str]
def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ...,
updated: Sequence[str] = ...) -> None: ...
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...
def total_ordering(cls: type) -> type: ...
def cmp_to_key(mycmp): ...
# TODO: give a more specific return type for partial (a callable object with some attributes).
def partial(func: _AnyCallable, *args, **keywords) -> Any: ...

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

@@ -0,0 +1,8 @@
# Stubs for getpass (Python 2)
from typing import Any, IO
class GetPassWarning(UserWarning): ...
def getpass(prompt: str = 'Password: ', stream: IO[Any] = None) -> str: ...
def getuser() -> str: ...

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

@@ -0,0 +1,40 @@
# TODO(MichalPokorny): better types
from typing import Any, IO, Optional, Union
def bindtextdomain(domain: str, localedir: str = None) -> str: ...
def bind_textdomain_codeset(domain: str, codeset: str = None) -> str: ...
def textdomain(domain: str = None) -> str: ...
def gettext(message: str) -> str: ...
def lgettext(message: str) -> str: ...
def dgettext(domain: str, message: str) -> str: ...
def ldgettext(domain: str, message: str) -> str: ...
def ngettext(singular: str, plural: str, n: int) -> str: ...
def lngettext(singular: str, plural: str, n: int) -> str: ...
def dngettext(domain: str, singular: str, plural: str, n: int) -> str: ...
def ldngettext(domain: str, singular: str, plural: str, n: int) -> str: ...
class Translations(object):
def _parse(self, fp: IO[str]) -> None: ...
def add_fallback(self, fallback: Any) -> None: ...
def gettext(self, message: str) -> str: ...
def lgettext(self, message: str) -> str: ...
def ugettext(self, message: str) -> unicode: ...
def ngettext(self, singular: str, plural: str, n: int) -> str: ...
def lngettext(self, singular: str, plural: str, n: int) -> str: ...
def ungettext(self, singular: str, plural: str, n: int) -> str: ...
def info(self) -> Any: ...
def charset(self) -> Any: ...
def output_charset(self) -> Any: ...
def set_output_charset(self, charset: Any) -> None: ...
def install(self, unicode: bool = None, names: Any = None) -> None: ...
# TODO: NullTranslations, GNUTranslations
def find(domain: str, localedir: str = None, languages: List[str] = None,
all: Any = None) -> Optional[Union[str, List[str]]]: ...
def translation(domain: str, localedir: str = None, languages: List[str] = None,
class_: Any = None, fallback: Any = None, codeset: Any = None) -> Translations: ...
def install(domain: str, localedir: str = None, unicode: Any = None, codeset: Any = None,
names: Any = None) -> None: ...

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

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

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

@@ -0,0 +1,41 @@
# Stubs for gzip (Python 2)
#
# NOTE: Based on a dynamically typed stub automatically generated by stubgen.
from typing import Any, IO
import io
class GzipFile(io.BufferedIOBase):
myfileobj = ... # type: Any
max_read_chunk = ... # type: Any
mode = ... # type: Any
extrabuf = ... # type: Any
extrasize = ... # type: Any
extrastart = ... # type: Any
name = ... # type: Any
min_readsize = ... # type: Any
compress = ... # type: Any
fileobj = ... # type: Any
offset = ... # type: Any
mtime = ... # type: Any
def __init__(self, filename: str = None, mode: str = None, compresslevel: int = 9,
fileobj: IO[str] = None, mtime: float = None) -> None: ...
@property
def filename(self): ...
size = ... # type: Any
crc = ... # type: Any
def write(self, data): ...
def read(self, size=-1): ...
@property
def closed(self): ...
def close(self): ...
def flush(self, zlib_mode=...): ...
def fileno(self): ...
def rewind(self): ...
def readable(self): ...
def writable(self): ...
def seekable(self): ...
def seek(self, offset, whence=0): ...
def readline(self, size=-1): ...
def open(filename: str, mode: str = '', compresslevel: int = ...) -> GzipFile: ...

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

@@ -0,0 +1,27 @@
# Stubs for hashlib (Python 2)
from typing import Tuple
class _hash(object):
# This is not actually in the module namespace.
digest_size = 0
block_size = 0
def update(self, arg: str) -> None: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def copy(self) -> _hash: ...
def new(algo: str = None) -> _hash: ...
def md5(s: str = None) -> _hash: ...
def sha1(s: str = None) -> _hash: ...
def sha224(s: str = None) -> _hash: ...
def sha256(s: str = None) -> _hash: ...
def sha384(s: str = None) -> _hash: ...
def sha512(s: str = None) -> _hash: ...
algorithms = ... # type: Tuple[str, ...]
algorithms_guaranteed = ... # type: Tuple[str, ...]
algorithms_available = ... # type: Tuple[str, ...]
def pbkdf2_hmac(name: str, password: str, salt: str, rounds: int, dklen: int = None) -> str: ...

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

@@ -0,0 +1,11 @@
# Stubs for hmac (Python 2)
from typing import Any
class HMAC:
def update(self, msg: str) -> None: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def copy(self) -> HMAC: ...
def new(key: str, msg: str = None, digestmod: Any = None) -> HMAC: ...

View File

@@ -0,0 +1,9 @@
# Stubs for htmlentitydefs (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, Mapping
name2codepoint = ... # type: Mapping[str, int]
codepoint2name = ... # type: Mapping[int, str]
entitydefs = ... # type: Mapping[str, str]

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

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

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

@@ -0,0 +1,11 @@
# TODO incomplete
from typing import Any, List, Tuple
def isgenerator(object: Any) -> bool: ...
class _Frame:
...
_FrameRecord = Tuple[_Frame, str, int, str, List[str], int]
def currentframe() -> _FrameRecord: ...
def stack(context: int = None) -> List[_FrameRecord]: ...

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

@@ -0,0 +1,101 @@
# Stubs for io
# Based on https://docs.python.org/2/library/io.html
# Only a subset of functionality is included.
DEFAULT_BUFFER_SIZE = 0
from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Any, Union
def open(file: Union[str, unicode, int],
mode: unicode = 'r', buffering: int = -1, encoding: unicode = None,
errors: unicode = None, newline: unicode = None,
closefd: bool = True) -> IO[Any]: ...
class IOBase:
# TODO
...
class BytesIO(BinaryIO):
def __init__(self, initial_bytes: str = b'') -> None: ...
# TODO getbuffer
# TODO see comments in BinaryIO for missing functionality
def close(self) -> None: ...
def closed(self) -> bool: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, n: int = -1) -> str: ...
def readable(self) -> bool: ...
def readline(self, limit: int = -1) -> str: ...
def readlines(self, hint: int = -1) -> List[str]: ...
def seek(self, offset: int, whence: int = 0) -> None: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: int = None) -> int: ...
def writable(self) -> bool: ...
def write(self, s: str) -> None: ...
def writelines(self, lines: Iterable[str]) -> None: ...
def getvalue(self) -> str: ...
def read1(self) -> str: ...
def __iter__(self) -> Iterator[str]: ...
def __enter__(self) -> 'BytesIO': ...
def __exit__(self, type, value, traceback) -> bool: ...
class StringIO(TextIO):
def __init__(self, initial_value: unicode = '',
newline: unicode = None) -> None: ...
# TODO see comments in BinaryIO for missing functionality
def close(self) -> None: ...
def closed(self) -> bool: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, n: int = -1) -> unicode: ...
def readable(self) -> bool: ...
def readline(self, limit: int = -1) -> unicode: ...
def readlines(self, hint: int = -1) -> List[unicode]: ...
def seek(self, offset: int, whence: int = 0) -> None: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: int = None) -> int: ...
def writable(self) -> bool: ...
def write(self, s: unicode) -> None: ...
def writelines(self, lines: Iterable[unicode]) -> None: ...
def getvalue(self) -> unicode: ...
def __iter__(self) -> Iterator[unicode]: ...
def __enter__(self) -> 'StringIO': ...
def __exit__(self, type, value, traceback) -> bool: ...
class TextIOWrapper(TextIO):
# write_through is undocumented but used by subprocess
def __init__(self, buffer: IO[str], encoding: unicode = None,
errors: unicode = None, newline: unicode = None,
line_buffering: bool = False,
write_through: bool = True) -> None: ...
# TODO see comments in BinaryIO for missing functionality
def close(self) -> None: ...
def closed(self) -> bool: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, n: int = -1) -> unicode: ...
def readable(self) -> bool: ...
def readline(self, limit: int = -1) -> unicode: ...
def readlines(self, hint: int = -1) -> List[unicode]: ...
def seek(self, offset: int, whence: int = 0) -> None: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: int = None) -> int: ...
def writable(self) -> bool: ...
def write(self, s: unicode) -> None: ...
def writelines(self, lines: Iterable[unicode]) -> None: ...
def __iter__(self) -> Iterator[unicode]: ...
def __enter__(self) -> StringIO: ...
def __exit__(self, type, value, traceback) -> bool: ...
class BufferedIOBase(IOBase): ...

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

@@ -0,0 +1,12 @@
from typing import Any, IO
class JSONDecodeError(object):
def dumps(self, obj: Any) -> str: ...
def dump(self, obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ...
def loads(self, s: str) -> Any: ...
def load(self, fp: IO[str]) -> Any: ...
def dumps(obj: Any, sort_keys: bool = None, indent: int = None) -> str: ...
def dump(obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ...
def loads(s: str) -> Any: ...
def load(fp: IO[str]) -> Any: ...

View File

@@ -0,0 +1,239 @@
# Stubs for logging (Python 2.7)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, Dict, Optional, Sequence, Tuple, overload
CRITICAL = 0
FATAL = 0
ERROR = 0
WARNING = 0
WARN = 0
INFO = 0
DEBUG = 0
NOTSET = 0
def getLevelName(level: int) -> str: ...
def addLevelName(level: int, levelName: str) -> None: ...
class LogRecord:
name = ... # type: str
msg = ... # type: str
args = ... # type: Sequence[Any]
levelname = ... # type: str
levelno = ... # type: int
pathname = ... # type: str
filename = ... # type: str
module = ... # type: str
exc_info = ... # type: Tuple[Any, Any, Any]
exc_text = ... # type: str
lineno = ... # type: int
funcName = ... # type: Optional[str]
created = ... # type: float
msecs = ... # type: float
relativeCreated = ... # type: float
thread = ... # type: Any
threadName = ... # type: Any
processName = ... # type: Any
process = ... # type: Any
def __init__(self, name: str, level: int, pathname: str, lineno: int, msg: str,
args: Sequence[Any], exc_info: Tuple[Any, Any, Any], func: str = None) -> None: ...
def getMessage(self) -> str: ...
def makeLogRecord(dict: Dict[str, Any]) -> LogRecord: ...
class PercentStyle:
default_format = ... # type: Any
asctime_format = ... # type: Any
asctime_search = ... # type: Any
def __init__(self, fmt): ...
def usesTime(self): ...
def format(self, record): ...
class StrFormatStyle(PercentStyle):
default_format = ... # type: Any
asctime_format = ... # type: Any
asctime_search = ... # type: Any
def format(self, record): ...
class StringTemplateStyle(PercentStyle):
default_format = ... # type: Any
asctime_format = ... # type: Any
asctime_search = ... # type: Any
def __init__(self, fmt): ...
def usesTime(self): ...
def format(self, record): ...
BASIC_FORMAT = ... # type: Any
class Formatter:
converter = ... # type: Any
datefmt = ... # type: Any
def __init__(self, fmt: str = None, datefmt: str = None) -> None: ...
default_time_format = ... # type: Any
default_msec_format = ... # type: Any
def formatTime(self, record, datefmt=None): ...
def formatException(self, ei): ...
def usesTime(self): ...
def formatMessage(self, record): ...
def formatStack(self, stack_info): ...
def format(self, record: LogRecord) -> str: ...
class BufferingFormatter:
linefmt = ... # type: Any
def __init__(self, linefmt=None): ...
def formatHeader(self, records): ...
def formatFooter(self, records): ...
def format(self, records): ...
class Filter:
name = ... # type: Any
nlen = ... # type: Any
def __init__(self, name: str = '') -> None: ...
def filter(self, record: LogRecord) -> int: ...
class Filterer:
filters = ... # type: Any
def __init__(self) -> None: ...
def addFilter(self, filter: Filter) -> None: ...
def removeFilter(self, filter: Filter) -> None: ...
def filter(self, record: LogRecord) -> int: ...
class Handler(Filterer):
level = ... # type: Any
formatter = ... # type: Any
def __init__(self, level: int = ...) -> None: ...
def get_name(self): ...
def set_name(self, name): ...
name = ... # type: Any
lock = ... # type: Any
def createLock(self): ...
def acquire(self): ...
def release(self): ...
def setLevel(self, level: int) -> None: ...
def format(self, record: LogRecord) -> str: ...
def emit(self, record: LogRecord) -> None: ...
def handle(self, record: LogRecord) -> Any: ... # Return value undocumented
def setFormatter(self, fmt: Formatter) -> None: ...
def flush(self) -> None: ...
def close(self) -> None: ...
def handleError(self, record: LogRecord) -> None: ...
class StreamHandler(Handler):
terminator = ... # type: Any
stream = ... # type: Any
def __init__(self, stream=None): ...
def flush(self): ...
def emit(self, record): ...
class FileHandler(StreamHandler):
baseFilename = ... # type: Any
mode = ... # type: Any
encoding = ... # type: Any
delay = ... # type: Any
stream = ... # type: Any
def __init__(self, filename: str, mode: str = ..., encoding: str = None, delay: int = ...) -> None: ...
def close(self): ...
def emit(self, record): ...
class _StderrHandler(StreamHandler):
def __init__(self, level=...): ...
lastResort = ... # type: Any
class PlaceHolder:
loggerMap = ... # type: Any
def __init__(self, alogger): ...
def append(self, alogger): ...
def setLoggerClass(klass): ...
def getLoggerClass(): ...
class Manager:
root = ... # type: Any
disable = ... # type: Any
emittedNoHandlerWarning = ... # type: Any
loggerDict = ... # type: Any
loggerClass = ... # type: Any
logRecordFactory = ... # type: Any
def __init__(self, rootnode): ...
def getLogger(self, name): ...
def setLoggerClass(self, klass): ...
def setLogRecordFactory(self, factory): ...
class Logger(Filterer):
name = ... # type: Any
level = ... # type: Any
parent = ... # type: Any
propagate = False
handlers = ... # type: Any
disabled = ... # type: Any
def __init__(self, name: str, level: int = ...) -> None: ...
def setLevel(self, level: int) -> None: ...
def debug(self, msg: str, *args, **kwargs) -> None: ...
def info(self, msg: str, *args, **kwargs) -> None: ...
def warning(self, msg: str, *args, **kwargs) -> None: ...
def warn(self, msg: str, *args, **kwargs) -> None: ...
def error(self, msg: str, *args, **kwargs) -> None: ...
def exception(self, msg: str, *args, **kwargs) -> None: ...
def critical(self, msg: str, *args, **kwargs) -> None: ...
fatal = ... # type: Any
def log(self, level: int, msg: str, *args, **kwargs) -> None: ...
def findCaller(self) -> Tuple[str, int, str]: ...
def makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None,
sinfo=None): ...
def handle(self, record): ...
def addHandler(self, hdlr: Handler) -> None: ...
def removeHandler(self, hdlr: Handler) -> None: ...
def hasHandlers(self): ...
def callHandlers(self, record): ...
def getEffectiveLevel(self) -> int: ...
def isEnabledFor(self, level: int) -> bool: ...
def getChild(self, suffix: str) -> Logger: ...
class RootLogger(Logger):
def __init__(self, level): ...
class LoggerAdapter:
logger = ... # type: Any
extra = ... # type: Any
def __init__(self, logger, extra): ...
def process(self, msg, kwargs): ...
def debug(self, msg: str, *args, **kwargs) -> None: ...
def info(self, msg: str, *args, **kwargs) -> None: ...
def warning(self, msg: str, *args, **kwargs) -> None: ...
def warn(self, msg: str, *args, **kwargs) -> None: ...
def error(self, msg: str, *args, **kwargs) -> None: ...
def exception(self, msg: str, *args, **kwargs) -> None: ...
def critical(self, msg: str, *args, **kwargs) -> None: ...
def log(self, level: int, msg: str, *args, **kwargs) -> None: ...
def isEnabledFor(self, level: int) -> bool: ...
def setLevel(self, level: int) -> None: ...
def getEffectiveLevel(self) -> int: ...
def hasHandlers(self): ...
def basicConfig(**kwargs) -> None: ...
def getLogger(name: str = None) -> Logger: ...
def critical(msg: str, *args, **kwargs) -> None: ...
fatal = ... # type: Any
def error(msg: str, *args, **kwargs) -> None: ...
@overload
def exception(msg: str, *args, **kwargs) -> None: ...
@overload
def exception(exception: Exception, *args, **kwargs) -> None: ...
def warning(msg: str, *args, **kwargs) -> None: ...
def warn(msg: str, *args, **kwargs) -> None: ...
def info(msg: str, *args, **kwargs) -> None: ...
def debug(msg: str, *args, **kwargs) -> None: ...
def log(level: int, msg: str, *args, **kwargs) -> None: ...
def disable(level: int) -> None: ...
class NullHandler(Handler):
def handle(self, record): ...
def emit(self, record): ...
lock = ... # type: Any
def createLock(self): ...
def captureWarnings(capture: bool) -> None: ...

View File

@@ -0,0 +1,200 @@
# Stubs for logging.handlers (Python 2.7)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
import logging
threading = ... # type: Any
DEFAULT_TCP_LOGGING_PORT = ... # type: Any
DEFAULT_UDP_LOGGING_PORT = ... # type: Any
DEFAULT_HTTP_LOGGING_PORT = ... # type: Any
DEFAULT_SOAP_LOGGING_PORT = ... # type: Any
SYSLOG_UDP_PORT = ... # type: Any
SYSLOG_TCP_PORT = ... # type: Any
class BaseRotatingHandler(logging.FileHandler):
mode = ... # type: Any
encoding = ... # type: Any
namer = ... # type: Any
rotator = ... # type: Any
def __init__(self, filename, mode, encoding=None, delay=0): ...
def emit(self, record): ...
def rotation_filename(self, default_name): ...
def rotate(self, source, dest): ...
class RotatingFileHandler(BaseRotatingHandler):
maxBytes = ... # type: Any
backupCount = ... # type: Any
def __init__(self, filename: str, mode: str = ..., maxBytes: int = ..., backupCount:int = ...,
encoding: str = None, delay: int = ...) -> None: ...
stream = ... # type: Any
def doRollover(self): ...
def shouldRollover(self, record): ...
class TimedRotatingFileHandler(BaseRotatingHandler):
when = ... # type: Any
backupCount = ... # type: Any
utc = ... # type: Any
atTime = ... # type: Any
interval = ... # type: Any
suffix = ... # type: Any
extMatch = ... # type: Any
dayOfWeek = ... # type: Any
rolloverAt = ... # type: Any
def __init__(self, filename, when='', interval=1, backupCount=0, encoding=None, delay=0,
utc=False, atTime=None): ...
def computeRollover(self, currentTime): ...
def shouldRollover(self, record): ...
def getFilesToDelete(self): ...
stream = ... # type: Any
def doRollover(self): ...
class WatchedFileHandler(logging.FileHandler):
def __init__(self, filename: str, mode: str = ..., encoding: str = None, delay: int = ...): ...
stream = ... # type: Any
def emit(self, record): ...
class SocketHandler(logging.Handler):
host = ... # type: Any
port = ... # type: Any
address = ... # type: Any
sock = ... # type: Any
closeOnError = ... # type: Any
retryTime = ... # type: Any
retryStart = ... # type: Any
retryMax = ... # type: Any
retryFactor = ... # type: Any
def __init__(self, host, port): ...
def makeSocket(self, timeout=1): ...
retryPeriod = ... # type: Any
def createSocket(self): ...
def send(self, s): ...
def makePickle(self, record): ...
def handleError(self, record): ...
def emit(self, record): ...
def close(self): ...
class DatagramHandler(SocketHandler):
closeOnError = ... # type: Any
def __init__(self, host, port): ...
def makeSocket(self, timeout=1): ... # TODO: Actually does not have the timeout argument.
def send(self, s): ...
class SysLogHandler(logging.Handler):
LOG_EMERG = ... # type: Any
LOG_ALERT = ... # type: Any
LOG_CRIT = ... # type: Any
LOG_ERR = ... # type: Any
LOG_WARNING = ... # type: Any
LOG_NOTICE = ... # type: Any
LOG_INFO = ... # type: Any
LOG_DEBUG = ... # type: Any
LOG_KERN = ... # type: Any
LOG_USER = ... # type: Any
LOG_MAIL = ... # type: Any
LOG_DAEMON = ... # type: Any
LOG_AUTH = ... # type: Any
LOG_SYSLOG = ... # type: Any
LOG_LPR = ... # type: Any
LOG_NEWS = ... # type: Any
LOG_UUCP = ... # type: Any
LOG_CRON = ... # type: Any
LOG_AUTHPRIV = ... # type: Any
LOG_FTP = ... # type: Any
LOG_LOCAL0 = ... # type: Any
LOG_LOCAL1 = ... # type: Any
LOG_LOCAL2 = ... # type: Any
LOG_LOCAL3 = ... # type: Any
LOG_LOCAL4 = ... # type: Any
LOG_LOCAL5 = ... # type: Any
LOG_LOCAL6 = ... # type: Any
LOG_LOCAL7 = ... # type: Any
priority_names = ... # type: Any
facility_names = ... # type: Any
priority_map = ... # type: Any
address = ... # type: Any
facility = ... # type: Any
socktype = ... # type: Any
unixsocket = ... # type: Any
socket = ... # type: Any
formatter = ... # type: Any
def __init__(self, address=..., facility=..., socktype=None): ...
def encodePriority(self, facility, priority): ...
def close(self): ...
def mapPriority(self, levelName): ...
ident = ... # type: Any
append_nul = ... # type: Any
def emit(self, record): ...
class SMTPHandler(logging.Handler):
username = ... # type: Any
fromaddr = ... # type: Any
toaddrs = ... # type: Any
subject = ... # type: Any
secure = ... # type: Any
timeout = ... # type: Any
def __init__(self, mailhost, fromaddr, toaddrs, subject, credentials=None, secure=None,
timeout=0.0): ...
def getSubject(self, record): ...
def emit(self, record): ...
class NTEventLogHandler(logging.Handler):
appname = ... # type: Any
dllname = ... # type: Any
logtype = ... # type: Any
deftype = ... # type: Any
typemap = ... # type: Any
def __init__(self, appname, dllname=None, logtype=''): ...
def getMessageID(self, record): ...
def getEventCategory(self, record): ...
def getEventType(self, record): ...
def emit(self, record): ...
def close(self): ...
class HTTPHandler(logging.Handler):
host = ... # type: Any
url = ... # type: Any
method = ... # type: Any
secure = ... # type: Any
credentials = ... # type: Any
def __init__(self, host, url, method='', secure=False, credentials=None): ...
def mapLogRecord(self, record): ...
def emit(self, record): ...
class BufferingHandler(logging.Handler):
capacity = ... # type: Any
buffer = ... # type: Any
def __init__(self, capacity: int) -> None: ...
def shouldFlush(self, record): ...
def emit(self, record): ...
def flush(self): ...
def close(self): ...
class MemoryHandler(BufferingHandler):
flushLevel = ... # type: Any
target = ... # type: Any
def __init__(self, capacity, flushLevel=..., target=None): ...
def shouldFlush(self, record): ...
def setTarget(self, target): ...
buffer = ... # type: Any
def flush(self): ...
def close(self): ...
class QueueHandler(logging.Handler):
queue = ... # type: Any
def __init__(self, queue): ...
def enqueue(self, record): ...
def prepare(self, record): ...
def emit(self, record): ...
class QueueListener:
queue = ... # type: Any
handlers = ... # type: Any
def __init__(self, queue, *handlers): ...
def dequeue(self, block): ...
def start(self): ...
def prepare(self, record): ...
def handle(self, record): ...
def enqueue_sentinel(self): ...
def stop(self): ...

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

@@ -0,0 +1,11 @@
# Stubs for Python 2.7 md5 stdlib module
class md5(object):
def update(self, arg: str) -> None: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def copy(self) -> md5: ...
def new(string: str = None) -> md5: ...
blocksize = 0
digest_size = 0

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

@@ -0,0 +1,77 @@
# Stubs for numbers (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
class Number:
__metaclass__ = ... # type: Any
__hash__ = ... # type: Any
class Complex(Number):
def __complex__(self): ...
def __nonzero__(self): ...
def real(self): ...
def imag(self): ...
def __add__(self, other): ...
def __radd__(self, other): ...
def __neg__(self): ...
def __pos__(self): ...
def __sub__(self, other): ...
def __rsub__(self, other): ...
def __mul__(self, other): ...
def __rmul__(self, other): ...
def __div__(self, other): ...
def __rdiv__(self, other): ...
def __truediv__(self, other): ...
def __rtruediv__(self, other): ...
def __pow__(self, exponent): ...
def __rpow__(self, base): ...
def __abs__(self): ...
def conjugate(self): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
class Real(Complex):
def __float__(self): ...
def __trunc__(self): ...
def __divmod__(self, other): ...
def __rdivmod__(self, other): ...
def __floordiv__(self, other): ...
def __rfloordiv__(self, other): ...
def __mod__(self, other): ...
def __rmod__(self, other): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __complex__(self): ...
@property
def real(self): ...
@property
def imag(self): ...
def conjugate(self): ...
class Rational(Real):
def numerator(self): ...
def denominator(self): ...
def __float__(self): ...
class Integral(Rational):
def __long__(self): ...
def __index__(self): ...
def __pow__(self, exponent, modulus=None): ...
def __lshift__(self, other): ...
def __rlshift__(self, other): ...
def __rshift__(self, other): ...
def __rrshift__(self, other): ...
def __and__(self, other): ...
def __rand__(self, other): ...
def __xor__(self, other): ...
def __rxor__(self, other): ...
def __or__(self, other): ...
def __ror__(self, other): ...
def __invert__(self): ...
def __float__(self): ...
@property
def numerator(self): ...
@property
def denominator(self): ...

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

@@ -0,0 +1,184 @@
# created from https://docs.python.org/2/library/os.html
from typing import List, Tuple, Union, Sequence, Mapping, IO, Any, Optional, AnyStr
import os.path as path
error = OSError
name = ... # type: str
environ = ... # type: Mapping[str, str]
def chdir(path: unicode) -> None: ...
def fchdir(fd: int) -> None: ...
def getcwd() -> str: ...
def ctermid() -> str: ...
def getegid() -> int: ...
def geteuid() -> int: ...
def getgid() -> int: ...
def getgroups() -> List[int]: ...
def initgroups(username: str, gid: int) -> None: ...
def getlogin() -> str: ...
def getpgid(pid: int) -> int: ...
def getpgrp() -> int: ...
def getpid() -> int: ...
def getppid() -> int: ...
def getresuid() -> Tuple[int, int, int]: ...
def getresgid() -> Tuple[int, int, int]: ...
def getuid() -> int: ...
def getenv(varname: str, value: str = None) -> str: ...
def putenv(varname: str, value: str) -> None: ...
def setegid(egid: int) -> None: ...
def seteuid(euid: int) -> None: ...
def setgid(gid: int) -> None: ...
def setgroups(groups: Sequence[int]) -> None: ...
# TODO(MichalPokorny)
def setpgrp(*args) -> None: ...
def setpgid(pid: int, pgrp: int) -> None: ...
def setregid(rgid: int, egid: int) -> None: ...
def setresgid(rgid: int, egid: int, sgid: int) -> None: ...
def setresuid(ruid: int, euid: int, suid: int) -> None: ...
def setreuid(ruid: int, euid: int) -> None: ...
def getsid(pid: int) -> int: ...
def setsid() -> None: ...
def setuid(pid: int) -> None: ...
def strerror(code: int) -> str:
raise ValueError()
def umask(mask: int) -> int: ...
def uname() -> Tuple[str, str, str, str, str]: ...
def unsetenv(varname: str) -> None: ...
# TODO(MichalPokorny)
def fdopen(fd: int, *args, **kwargs) -> IO[Any]: ...
def popen(command: str, *args, **kwargs) -> Optional[IO[Any]]: ...
def tmpfile() -> IO[Any]: ...
def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
def popen3(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any], IO[Any]]: ...
def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
def close(fd: int) -> None: ...
def closerange(fd_low: int, fd_high: int) -> None: ...
def dup(fd: int) -> int: ...
def dup2(fd: int, fd2: int) -> None: ...
def fchmod(fd: int, mode: int) -> None: ...
def fchown(fd: int, uid: int, gid: int) -> None: ...
def fdatasync(fd: int) -> None: ...
def fpathconf(fd: int, name: str) -> None: ...
# TODO(prvak)
def fstat(fd: int) -> Any: ...
def fstatvfs(fd: int) -> Any: ...
def fsync(fd: int) -> None: ...
def ftruncate(fd: int, length: int) -> None: ...
def isatty(fd: int) -> bool: ...
def lseek(fd: int, pos: int, how: int) -> None: ...
SEEK_SET = 0
SEEK_CUR = 1
SEEK_END = 2
# TODO(prvak): maybe file should be unicode? (same with all other paths...)
def open(file: unicode, flags: int, mode: int = 0777) -> int: ...
def openpty() -> Tuple[int, int]: ...
def pipe() -> Tuple[int, int]: ...
def read(fd: int, n: int) -> str: ...
def tcgetpgrp(fd: int) -> int: ...
def tcsetpgrp(fd: int, pg: int) -> None: ...
def ttyname(fd: int) -> str: ...
def write(fd: int, str: str) -> int: ...
# TODO: O_*
def access(path: unicode, mode: int) -> bool: ...
F_OK = 0
R_OK = 0
W_OK = 0
X_OK = 0
def getcwdu() -> unicode: ...
def chflags(path: unicode, flags: int) -> None: ...
def chroot(path: unicode) -> None: ...
def chmod(path: unicode, mode: int) -> None: ...
def chown(path: unicode, uid: int, gid: int) -> None: ...
def lchflags(path: unicode, flags: int) -> None: ...
def lchmod(path: unicode, uid: int, gid: int) -> None: ...
def lchown(path: unicode, uid: int, gid: int) -> None: ...
def link(source: unicode, link_name: unicode) -> None: ...
def listdir(path: AnyStr) -> List[AnyStr]: ...
# TODO(MichalPokorny)
def lstat(path: unicode) -> Any: ...
def mkfifo(path: unicode, mode: int = 0666) -> None: ...
def mknod(filename: unicode, mode: int = 0600, device: int = 0) -> None: ...
def major(device: int) -> int: ...
def minor(device: int) -> int: ...
def makedev(major: int, minor: int) -> int: ...
def mkdir(path: unicode, mode: int = 0777) -> None: ...
def makedirs(path: unicode, mode: int = 0777) -> None: ...
def pathconf(path: unicode, name: str) -> str: ...
pathconf_names = ... # type: Mapping[str, int]
def readlink(path: AnyStr) -> AnyStr: ...
def remove(path: unicode) -> None: ...
def removedirs(path: unicode) -> None:
raise OSError()
def rename(src: unicode, dst: unicode) -> None: ...
def renames(old: unicode, new: unicode) -> None: ...
def rmdir(path: unicode) -> None: ...
# TODO(MichalPokorny)
def stat(path: unicode) -> Any: ...
# TODO: stat_float_times, statvfs, tempnam, tmpnam, TMP_MAX, walk
def symlink(source: unicode, link_name: unicode) -> None: ...
def unlink(path: unicode) -> None: ...
def utime(path: unicode, times: Optional[Tuple[int, int]]) -> None: ...
def abort() -> None: ...
# TODO: exec*, _exit, EX_*
def fork() -> int:
raise OSError()
def forkpty() -> Tuple[int, int]:
raise OSError()
def kill(pid: int, sig: int) -> None: ...
def killpg(pgid: int, sig: int) -> None: ...
def nice(increment: int) -> int: ...
# TODO: plock, popen*, spawn*, P_*
def startfile(path: unicode, operation: str) -> None: ...
def system(command: unicode) -> int: ...
def times() -> Tuple[float, float, float, float, float]: ...
def wait() -> int: ...
def waitpid(pid: int, options: int) -> int:
raise OSError()
# TODO: wait3, wait4, W...
def confstr(name: Union[str, int]) -> Optional[str]: ...
confstr_names = ... # type: Mapping[str, int]
def getloadavg() -> Tuple[float, float, float]:
raise OSError()
def sysconf(name: Union[str, int]) -> int: ...
sysconf_names = ... # type: Mapping[str, int]
curdir = ... # type: str
pardir = ... # type: str
sep = ... # type: str
altsep = ... # type: str
extsep = ... # type: str
pathsep = ... # type: str
defpath = ... # type: str
linesep = ... # type: str
devnll = ... # type: str
def urandom(n: int) -> str: ...

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

@@ -0,0 +1,65 @@
# Stubs for os.path
# Ron Murawski <ron@horizonchess.com>
# based on http://docs.python.org/3.2/library/os.path.html
# adapted for 2.7 by Michal Pokorny
from typing import overload, List, Any, Tuple, BinaryIO, TextIO, TypeVar, Callable, AnyStr
# ----- os.path variables -----
supports_unicode_filenames = False
# aliases (also in os)
curdir = ''
pardir = ''
sep = ''
altsep = ''
extsep = ''
pathsep = ''
defpath = ''
devnull = ''
# ----- os.path function stubs -----
def abspath(path: AnyStr) -> AnyStr: ...
def basename(path: AnyStr) -> AnyStr: ...
def commonprefix(list: List[AnyStr]) -> AnyStr: ...
def dirname(path: AnyStr) -> AnyStr: ...
def exists(path: unicode) -> bool: ...
def lexists(path: unicode) -> bool: ...
def expanduser(path: AnyStr) -> AnyStr: ...
def expandvars(path: AnyStr) -> AnyStr: ...
# These return float if os.stat_float_times() == True,
# but int is a subclass of float.
def getatime(path: unicode) -> float: ...
def getmtime(path: unicode) -> float: ...
def getctime(path: unicode) -> float: ...
def getsize(path: unicode) -> int: ...
def isabs(path: unicode) -> bool: ...
def isfile(path: unicode) -> bool: ...
def isdir(path: unicode) -> bool: ...
def islink(path: unicode) -> bool: ...
def ismount(path: unicode) -> bool: ...
def join(path: AnyStr, *paths: AnyStr) -> AnyStr: ...
def normcase(path: AnyStr) -> AnyStr: ...
def normpath(path: AnyStr) -> AnyStr: ...
def realpath(path: AnyStr) -> AnyStr: ...
def relpath(path: AnyStr, start: AnyStr = None) -> AnyStr: ...
def samefile(path1: unicode, path2: unicode) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
# TODO
#def samestat(stat1: stat_result,
# stat2: stat_result) -> bool: ... # Unix only
def split(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitdrive(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # Windows only, deprecated
_T = TypeVar('_T')
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...

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

@@ -0,0 +1,8 @@
# Stubs for pickle (Python 2)
from typing import Any, IO
def dump(obj: Any, file: IO[str], protocol: int = None) -> None: ...
def dumps(obj: Any, protocol: int = None) -> str: ...
def load(file: IO[str]) -> Any: ...
def loads(str: str) -> Any: ...

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

@@ -0,0 +1,13 @@
from typing import Any, IO
class Template:
def __init__(self) -> None: ...
def reset(self) -> None: ...
def clone(self) -> Template: ...
def debug(flag: bool) -> None: ...
def append(cmd: str, kind: str) -> None: ...
def prepend(cmd: str, kind: str) -> None: ...
def open(file: str, mode: str) -> IO[Any]: ...
def copy(infile: str, outfile: str) -> None: ...
def quote(s: str) -> str: ...

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

@@ -0,0 +1,21 @@
# Stubs for pprint (Python 2)
#
# NOTE: Based on a dynamically typed automatically generated by stubgen.
from typing import IO, Any
def pprint(object: Any, stream: IO[Any] = None, indent: int = 1, width: int = 80,
depth: int = None) -> None: ...
def pformat(object, indent=1, width=80, depth=None): ...
def saferepr(object): ...
def isreadable(object): ...
def isrecursive(object): ...
class PrettyPrinter:
def __init__(self, indent: int = 1, width: int = 80, depth: int = None,
stream: IO[Any] = None) -> None: ...
def pprint(self, object): ...
def pformat(self, object): ...
def isrecursive(self, object): ...
def isreadable(self, object): ...
def format(self, object, context, maxlevels, level): ...

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

@@ -0,0 +1,79 @@
# Stubs for random
# Ron Murawski <ron@horizonchess.com>
# Updated by Jukka Lehtosalo
# based on https://docs.python.org/2/library/random.html
# ----- random classes -----
import _random
from typing import (
Any, TypeVar, Sequence, List, Callable, AbstractSet, Union,
overload
)
_T = TypeVar('_T')
class Random(_random.Random):
def __init__(self, x: object = None) -> None: ...
def seed(self, x: object = None) -> None: ...
def getstate(self) -> tuple: ...
def setstate(self, state: tuple) -> None: ...
def jumpahead(self, n : int) -> None: ...
def getrandbits(self, k: int) -> int: ...
@overload
def randrange(self, stop: int) -> int: ...
@overload
def randrange(self, start: int, stop: int, step: int = 1) -> int: ...
def randint(self, a: int, b: int) -> int: ...
def choice(self, seq: Sequence[_T]) -> _T: ...
def shuffle(self, x: List[Any], random: Callable[[], None] = None) -> None: ...
def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
def random(self) -> float: ...
def uniform(self, a: float, b: float) -> float: ...
def triangular(self, low: float = 0.0, high: float = 1.0,
mode: float = None) -> float: ...
def betavariate(self, alpha: float, beta: float) -> float: ...
def expovariate(self, lambd: float) -> float: ...
def gammavariate(self, alpha: float, beta: float) -> float: ...
def gauss(self, mu: float, sigma: float) -> float: ...
def lognormvariate(self, mu: float, sigma: float) -> float: ...
def normalvariate(self, mu: float, sigma: float) -> float: ...
def vonmisesvariate(self, mu: float, kappa: float) -> float: ...
def paretovariate(self, alpha: float) -> float: ...
def weibullvariate(self, alpha: float, beta: float) -> float: ...
# SystemRandom is not implemented for all OS's; good on Windows & Linux
class SystemRandom:
def __init__(self, randseed: object = None) -> None: ...
def random(self) -> float: ...
def getrandbits(self, k: int) -> int: ...
def seed(self, x: object = None) -> None: ...
# ----- random function stubs -----
def seed(x: object = None) -> None: ...
def getstate() -> object: ...
def setstate(state: object) -> None: ...
def jumpahead(n : int) -> None: ...
def getrandbits(k: int) -> int: ...
@overload
def randrange(stop: int) -> int: ...
@overload
def randrange(start: int, stop: int, step: int = 1) -> int: ...
def randint(a: int, b: int) -> int: ...
def choice(seq: Sequence[_T]) -> _T: ...
def shuffle(x: List[Any], random: Callable[[], float] = None) -> None: ...
def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
def random() -> float: ...
def uniform(a: float, b: float) -> float: ...
def triangular(low: float = 0.0, high: float = 1.0,
mode: float = None) -> float: ...
def betavariate(alpha: float, beta: float) -> float: ...
def expovariate(lambd: float) -> float: ...
def gammavariate(alpha: float, beta: float) -> float: ...
def gauss(mu: float, sigma: float) -> float: ...
def lognormvariate(mu: float, sigma: float) -> float: ...
def normalvariate(mu: float, sigma: float) -> float: ...
def vonmisesvariate(mu: float, kappa: float) -> float: ...
def paretovariate(alpha: float) -> float: ...
def weibullvariate(alpha: float, beta: float) -> float: ...

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

@@ -0,0 +1,63 @@
# Stubs for re
# Ron Murawski <ron@horizonchess.com>
# 'bytes' support added by Jukka Lehtosalo
# based on: http://docs.python.org/2.7/library/re.html
from typing import (
List, Iterator, overload, Callable, Tuple, Sequence, Dict,
Generic, AnyStr, Match, Pattern
)
# ----- re variables and constants -----
A = 0
ASCII = 0
DEBUG = 0
I = 0
IGNORECASE = 0
L = 0
LOCALE = 0
M = 0
MULTILINE = 0
S = 0
DOTALL = 0
X = 0
VERBOSE = 0
class error(Exception): ...
def compile(pattern: AnyStr, flags: int = 0) -> Pattern[AnyStr]: ...
def search(pattern: AnyStr, string: AnyStr,
flags: int = 0) -> Match[AnyStr]: ...
def match(pattern: AnyStr, string: AnyStr,
flags: int = 0) -> Match[AnyStr]: ...
def split(pattern: AnyStr, string: AnyStr, maxsplit: int = 0,
flags: int = 0) -> List[AnyStr]: ...
def findall(pattern: AnyStr, string: AnyStr,
flags: int = 0) -> List[AnyStr]: ...
# Return an iterator yielding match objects over all non-overlapping matches
# for the RE pattern in string. The string is scanned left-to-right, and
# matches are returned in the order found. Empty matches are included in the
# result unless they touch the beginning of another match.
def finditer(pattern: AnyStr, string: AnyStr,
flags: int = 0) -> Iterator[Match[AnyStr]]: ...
@overload
def sub(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = 0,
flags: int = 0) -> AnyStr: ...
@overload
def sub(pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr],
string: AnyStr, count: int = 0, flags: int = 0) -> AnyStr: ...
@overload
def subn(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = 0,
flags: int = 0) -> Tuple[AnyStr, int]: ...
@overload
def subn(pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr],
string: AnyStr, count: int = 0,
flags: int = 0) -> Tuple[AnyStr, int]: ...
def escape(string: AnyStr) -> AnyStr: ...
def purge() -> None: ...

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

@@ -0,0 +1,12 @@
# Stubs for Python 2.7 sha stdlib module
class sha(object):
def update(self, arg: str) -> None: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def copy(self) -> sha: ...
def new(string: str = None) -> sha: ...
blocksize = 0
digest_size = 0

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