diff --git a/stdlib/2.7/__builtin__.pyi b/stdlib/2.7/__builtin__.pyi index 3f889be7e..9c59ed922 100644 --- a/stdlib/2.7/__builtin__.pyi +++ b/stdlib/2.7/__builtin__.pyi @@ -191,12 +191,12 @@ class unicode(basestring, Sequence[unicode]): @overload def __init__(self, o: object) -> None: ... @overload - def __init__(self, o: str, encoding: unicode = ..., errors: unicode = 'strict') -> None: ... + def __init__(self, o: str, encoding: unicode = ..., errors: unicode = ...) -> 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 decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ... + def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ... def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]], start: int = 0, end: int = ...) -> bool: ... def expandtabs(self, tabsize: int = 8) -> unicode: ... @@ -267,8 +267,8 @@ class str(basestring, Sequence[str]): 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 decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ... + def encode(self, encoding: unicode = ..., errors: unicode = ...) -> 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: ... @@ -359,13 +359,13 @@ class bytearray(Sequence[int]): def __init__(self, x: Union[Iterable[int], str]) -> None: ... @overload def __init__(self, x: unicode, encoding: unicode, - errors: unicode = 'strict') -> None: ... + errors: unicode = ...) -> 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 decode(self, encoding: unicode = ..., errors: unicode = ...) -> 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: ... diff --git a/stdlib/2.7/csv.pyi b/stdlib/2.7/csv.pyi index 37b51ce39..ce330105e 100644 --- a/stdlib/2.7/csv.pyi +++ b/stdlib/2.7/csv.pyi @@ -61,7 +61,7 @@ class excel_tab(excel): class unix_dialect(Dialect): pass -class DictReader: +class DictReader(Iterable): restkey = ... # type: Any restval = ... # type: Any reader = ... # type: Any diff --git a/stdlib/2.7/doctest.pyi b/stdlib/2.7/doctest.pyi new file mode 100644 index 000000000..ab88328c8 --- /dev/null +++ b/stdlib/2.7/doctest.pyi @@ -0,0 +1,9 @@ +# Stubs for doctest + +# NOTE: These are incomplete! + +from typing import Any, Tuple + +# TODO arguments missing +def testmod(m: Any = ..., name: str = ..., globs: Any = ..., + verbose: bool = ...) -> Tuple[int, int]: ... diff --git a/stdlib/2.7/inspect.pyi b/stdlib/2.7/inspect.pyi index f59dec6aa..1ea9fa4c5 100644 --- a/stdlib/2.7/inspect.pyi +++ b/stdlib/2.7/inspect.pyi @@ -1,5 +1,5 @@ # TODO incomplete -from typing import Any, List, Tuple +from typing import Any, List, Tuple, NamedTuple def isgenerator(object: Any) -> bool: ... @@ -9,3 +9,11 @@ _FrameRecord = Tuple[_Frame, str, int, str, List[str], int] def currentframe() -> _FrameRecord: ... def stack(context: int = ...) -> List[_FrameRecord]: ... + +ArgSpec = NamedTuple('ArgSpec', [('args', List[str]), + ('varargs', str), + ('keywords', str), + ('defaults', tuple), + ]) + +def getargspec(func: object) -> ArgSpec: ... diff --git a/stdlib/2.7/platform.pyi b/stdlib/2.7/platform.pyi new file mode 100644 index 000000000..83c61fa9c --- /dev/null +++ b/stdlib/2.7/platform.pyi @@ -0,0 +1,45 @@ +# Stubs for platform (Python 2) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any + +__copyright__ = ... # type: Any +DEV_NULL = ... # type: Any + +def libc_ver(executable=..., lib='', version='', chunksize=2048): ... +def linux_distribution(distname='', version='', id='', supported_dists=..., full_distribution_name=1): ... +def dist(distname='', version='', id='', supported_dists=...): ... + +class _popen: + tmpfile = ... # type: Any + pipe = ... # type: Any + bufsize = ... # type: Any + mode = ... # type: Any + def __init__(self, cmd, mode='', bufsize=None): ... + def read(self): ... + def readlines(self): ... + def close(self, remove=..., error=...): ... + __del__ = ... # type: Any + +def popen(cmd, mode='', bufsize=None): ... +def win32_ver(release='', version='', csd='', ptype=''): ... +def mac_ver(release='', versioninfo=..., machine=''): ... +def java_ver(release='', vendor='', vminfo=..., osinfo=...): ... +def system_alias(system, release, version): ... +def architecture(executable=..., bits='', linkage=''): ... +def uname(): ... +def system(): ... +def node(): ... +def release(): ... +def version(): ... +def machine(): ... +def processor(): ... +def python_implementation(): ... +def python_version(): ... +def python_version_tuple(): ... +def python_branch(): ... +def python_revision(): ... +def python_build(): ... +def python_compiler(): ... +def platform(aliased=0, terse=0): ... diff --git a/stdlib/2.7/zlib.pyi b/stdlib/2.7/zlib.pyi index 72bfc88c1..d6a2c8cdc 100644 --- a/stdlib/2.7/zlib.pyi +++ b/stdlib/2.7/zlib.pyi @@ -23,14 +23,14 @@ def crc32(data: str, value: int = ...) -> int: ... def decompress(data: str, wbits: int = ..., bufsize: int = ...) -> str: ... class compressobj: - def __init__(level: int = ..., method: int = ..., wbits: int = ..., memlevel: int = ..., + def __init__(self, level: int = ..., method: int = ..., wbits: int = ..., memlevel: int = ..., strategy: int = ...) -> None: ... def copy(self) -> "compressobj": ... def compress(self, data: str) -> str: ... def flush(self) -> None: ... class decompressobj: - def __init__(wbits: int = ...) -> None: ... + def __init__(self, wbits: int = ...) -> None: ... def copy(self) -> "decompressobj": ... - def decompress(self, data: str) -> str: ... + def decompress(self, data: str, max_length: int = ...) -> str: ... def flush(self) -> None: ... diff --git a/stdlib/3.4/asyncio/events.pyi b/stdlib/3.4/asyncio/events.pyi index bcac004cb..afdd6397e 100644 --- a/stdlib/3.4/asyncio/events.pyi +++ b/stdlib/3.4/asyncio/events.pyi @@ -1,4 +1,4 @@ -from typing import Any, Awaitable, TypeVar, List, Callable, Tuple, Union, Dict +from typing import Any, Awaitable, TypeVar, List, Callable, Tuple, Union, Dict, Generator from abc import ABCMeta, abstractmethod from asyncio.futures import Future @@ -34,7 +34,7 @@ class AbstractEventLoop(metaclass=ABCMeta): @abstractmethod def run_forever(self) -> None: ... @abstractmethod - def run_until_complete(self, future: Union[Awaitable[_T], Future[_T]]) -> _T: ... + def run_until_complete(self, future: Union[Awaitable[_T], Future[_T], Generator[Any, Any, _T]]) -> _T: ... @abstractmethod def stop(self) -> None: ... @abstractmethod diff --git a/stdlib/3.4/asyncio/futures.pyi b/stdlib/3.4/asyncio/futures.pyi index 5de3327de..37e72a157 100644 --- a/stdlib/3.4/asyncio/futures.pyi +++ b/stdlib/3.4/asyncio/futures.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, TypeVar, List, Generic, Iterable, Iterator +from typing import Any, Union, Callable, TypeVar, List, Generic, Iterable, Generator from asyncio.events import AbstractEventLoop # __all__ = ['CancelledError', 'TimeoutError', # 'InvalidStateError', @@ -10,16 +10,16 @@ _T = TypeVar('_T') class _TracebackLogger: __slots__ = [] # type: List[str] - exc = ... # type: Exception + exc = ... # type: BaseException tb = [] # type: List[str] def __init__(self, exc: Any, loop: AbstractEventLoop) -> None: ... def activate(self) -> None: ... def clear(self) -> None: ... def __del__(self) -> None: ... -class Future(Iterator[_T], Generic[_T]): +class Future(Iterable[_T], Generic[_T]): _state = ... # type: str - _exception = ... # type: Exception + _exception = ... # type: BaseException _blocking = False _log_traceback = False _tb_logger = _TracebackLogger @@ -31,11 +31,10 @@ class Future(Iterator[_T], Generic[_T]): def cancelled(self) -> bool: ... def done(self) -> bool: ... def result(self) -> _T: ... - def exception(self) -> Any: ... + def exception(self) -> BaseException: ... def add_done_callback(self, fn: Callable[[Future[_T]], Any]) -> None: ... def remove_done_callback(self, fn: Callable[[Future[_T]], Any]) -> int: ... def set_result(self, result: _T) -> None: ... - def set_exception(self, exception: Any) -> None: ... + def set_exception(self, exception: Union[type, BaseException]) -> None: ... def _copy_state(self, other: Any) -> None: ... - def __iter__(self) -> Iterator[_T]: ... - def __next__(self) -> _T: ... + def __iter__(self) -> Generator[Any, None, _T]: ... diff --git a/stdlib/3.4/asyncio/tasks.pyi b/stdlib/3.4/asyncio/tasks.pyi index 9d5dc7aa2..3adebe1ba 100644 --- a/stdlib/3.4/asyncio/tasks.pyi +++ b/stdlib/3.4/asyncio/tasks.pyi @@ -1,4 +1,4 @@ -from typing import Any, Iterable, TypeVar, Set, Dict, List, TextIO, Union, Tuple, Generic, Callable +from typing import Any, Iterable, TypeVar, Set, Dict, List, TextIO, Union, Tuple, Generic, Callable, Generator from asyncio.events import AbstractEventLoop from asyncio.futures import Future # __all__ = ['iscoroutinefunction', 'iscoroutine', @@ -18,7 +18,7 @@ def coroutine(f: _T) -> _T: ... # Here comes and go a function def sleep(delay: float, result: _T = ..., loop: AbstractEventLoop = ...) -> Future[_T]: ... def wait(fs: List[Task[_T]], *, loop: AbstractEventLoop = ..., timeout: float = ..., return_when: str = ...) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ... -def wait_for(fut: Future[_T], timeout: float, *, loop: AbstractEventLoop = ...) -> Future[_T]: ... +def wait_for(fut: Union[Future[_T], Generator[Any, None, _T]], timeout: float, *, loop: AbstractEventLoop = ...) -> Future[_T]: ... class Task(Future[_T], Generic[_T]): @@ -28,7 +28,7 @@ class Task(Future[_T], Generic[_T]): def current_task(cls, loop: AbstractEventLoop = ...) -> Task: ... @classmethod def all_tasks(cls, loop: AbstractEventLoop = ...) -> Set[Task]: ... - def __init__(self, coro: Future[_T], *, loop: AbstractEventLoop = ...) -> None: ... + def __init__(self, coro: Union[Future[_T], Generator[Any, None, _T]], *, loop: AbstractEventLoop = ...) -> None: ... def __repr__(self) -> str: ... def get_stack(self, *, limit: int = ...) -> List[Any]: ... # return List[stackframe] def print_stack(self, *, limit: int = ..., file: TextIO = ...) -> None: ... diff --git a/stdlib/3/csv.pyi b/stdlib/3/csv.pyi index 72dc2d26b..7b41cc8c2 100644 --- a/stdlib/3/csv.pyi +++ b/stdlib/3/csv.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any +from typing import Any, Iterable QUOTE_ALL = ... # type: int QUOTE_MINIMAL = ... # type: int @@ -48,7 +48,7 @@ class unix_dialect(Dialect): lineterminator = ... # type: Any quoting = ... # type: Any -class DictReader: +class DictReader(Iterable): restkey = ... # type: Any restval = ... # type: Any reader = ... # type: Any diff --git a/stdlib/3/html/__init__.pyi b/stdlib/3/html/__init__.pyi new file mode 100644 index 000000000..e69de29bb diff --git a/stdlib/3/html/entities.pyi b/stdlib/3/html/entities.pyi new file mode 100644 index 000000000..7cc90b450 --- /dev/null +++ b/stdlib/3/html/entities.pyi @@ -0,0 +1,10 @@ +# Stubs for html.entities (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any + +name2codepoint = ... # type: Any +html5 = ... # type: Any +codepoint2name = ... # type: Any +entitydefs = ... # type: Any diff --git a/stdlib/3/inspect.pyi b/stdlib/3/inspect.pyi index 9286aa04f..abbc7f6d3 100644 --- a/stdlib/3/inspect.pyi +++ b/stdlib/3/inspect.pyi @@ -1,6 +1,6 @@ # Stubs for inspect -from typing import Any, Tuple, List, Callable +from typing import Any, Tuple, List, Dict, Callable, NamedTuple from types import FrameType _object = object @@ -22,13 +22,23 @@ def cleandoc(doc: str) -> str: ... def getsourcelines(obj: object) -> Tuple[List[str], int]: ... -# namedtuple('ArgSpec', 'args varargs keywords defaults') -class ArgSpec(tuple): - args = ... # type: List[str] - varargs = ... # type: str - keywords = ... # type: str - defaults = ... # type: tuple +ArgSpec = NamedTuple('ArgSpec', [('args', List[str]), + ('varargs', str), + ('keywords', str), + ('defaults', tuple), + ]) def getargspec(func: object) -> ArgSpec: ... +FullArgSpec = NamedTuple('FullArgSpec', [('args', List[str]), + ('varargs', str), + ('varkw', str), + ('defaults', tuple), + ('kwonlyargs', List[str]), + ('kwonlydefaults', Dict[str, Any]), + ('annotations', Dict[str, Any]), + ]) + +def getfullargspec(func: object) -> FullArgSpec: ... + def stack() -> List[Tuple[FrameType, str, int, str, List[str], int]]: ... diff --git a/stdlib/3/numbers.pyi b/stdlib/3/numbers.pyi new file mode 100644 index 000000000..8bea0b022 --- /dev/null +++ b/stdlib/3/numbers.pyi @@ -0,0 +1,80 @@ +# Stubs for numbers (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any + +class Number: + __hash__ = ... # type: Any + +class Complex(Number): + def __complex__(self): ... + def __bool__(self): ... + @property + def real(self): ... + @property + 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 __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): ... + +class Real(Complex): + def __float__(self): ... + def __trunc__(self): ... + def __floor__(self): ... + def __ceil__(self): ... + def __round__(self, ndigits=None): ... + 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): + @property + def numerator(self): ... + @property + def denominator(self): ... + def __float__(self): ... + +class Integral(Rational): + def __int__(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): ... diff --git a/stdlib/3/textwrap.pyi b/stdlib/3/textwrap.pyi index db8b5bf55..f6441042a 100644 --- a/stdlib/3/textwrap.pyi +++ b/stdlib/3/textwrap.pyi @@ -61,6 +61,7 @@ class TextWrapper: def wrap( + text: str = ..., width: int = ..., *, initial_indent: str = ..., diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index d4a0a0c60..1f31e8aa0 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -107,6 +107,9 @@ class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]): @abstractmethod def close(self) -> None:... + @abstractmethod + def __iter__(self) -> 'Generator[_T_co, _T_contra, _V_co]': ... + class AbstractFuture(Generic[_T]): ... class Awaitable(Generic[_T_co]): diff --git a/third_party/2and3/backports/__init__.pyi b/third_party/2and3/backports/__init__.pyi new file mode 100644 index 000000000..e69de29bb diff --git a/third_party/2and3/backports/ssl_match_hostname.pyi b/third_party/2and3/backports/ssl_match_hostname.pyi new file mode 100644 index 000000000..c21998013 --- /dev/null +++ b/third_party/2and3/backports/ssl_match_hostname.pyi @@ -0,0 +1,3 @@ +class CertificateError(ValueError): ... + +def match_hostname(cert, hostname): ... diff --git a/third_party/2and3/backports_abc.pyi b/third_party/2and3/backports_abc.pyi new file mode 100644 index 000000000..a82293fa4 --- /dev/null +++ b/third_party/2and3/backports_abc.pyi @@ -0,0 +1,19 @@ +# Stubs for backports_abc (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any + +def mk_gen(): ... +def mk_awaitable(): ... +def mk_coroutine(): ... + +Generator = ... # type: Any +Awaitable = ... # type: Any +Coroutine = ... # type: Any + +def isawaitable(obj): ... + +PATCHED = ... # type: Any + +def patch(patch_inspect=True): ... diff --git a/third_party/2and3/certifi.pyi b/third_party/2and3/certifi.pyi new file mode 100644 index 000000000..c809e6d49 --- /dev/null +++ b/third_party/2and3/certifi.pyi @@ -0,0 +1,2 @@ +def where() -> str: ... +def old_where() -> str: ... diff --git a/third_party/2and3/singledispatch.pyi b/third_party/2and3/singledispatch.pyi new file mode 100644 index 000000000..dac3ceae8 --- /dev/null +++ b/third_party/2and3/singledispatch.pyi @@ -0,0 +1,5 @@ +# Stubs for singledispatch (Python 3.5) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +def singledispatch(func): ...