add (overwrite with) mypy stubs, if available

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

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