mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-10 11:41:28 +08:00
Merge branch 'master' into threading
Conflicts: stdlib/3/threading.pyi
This commit is contained in:
@@ -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: ...
|
||||
|
||||
@@ -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
|
||||
|
||||
9
stdlib/2.7/doctest.pyi
Normal file
9
stdlib/2.7/doctest.pyi
Normal file
@@ -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]: ...
|
||||
@@ -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: ...
|
||||
|
||||
45
stdlib/2.7/platform.pyi
Normal file
45
stdlib/2.7/platform.pyi
Normal file
@@ -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): ...
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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
|
||||
|
||||
0
stdlib/3/html/__init__.pyi
Normal file
0
stdlib/3/html/__init__.pyi
Normal file
10
stdlib/3/html/entities.pyi
Normal file
10
stdlib/3/html/entities.pyi
Normal file
@@ -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
|
||||
@@ -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]]: ...
|
||||
|
||||
80
stdlib/3/numbers.pyi
Normal file
80
stdlib/3/numbers.pyi
Normal file
@@ -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): ...
|
||||
@@ -61,6 +61,7 @@ class TextWrapper:
|
||||
|
||||
|
||||
def wrap(
|
||||
text: str = ...,
|
||||
width: int = ...,
|
||||
*,
|
||||
initial_indent: str = ...,
|
||||
|
||||
@@ -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]):
|
||||
|
||||
Reference in New Issue
Block a user