Update a bunch of stubs

This commit is contained in:
Ben Longbons
2015-10-16 13:11:27 -07:00
parent e4a7edb949
commit 56fe787c74
34 changed files with 483 additions and 277 deletions

View File

@@ -1,165 +1,194 @@
# Stubs for codecs (Python 2)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
# Better codecs stubs hand-written by o11c.
# https://docs.python.org/2/library/codecs.html
from typing import (
BinaryIO,
Callable,
Iterable,
Iterator,
List,
Tuple,
Union,
)
from typing import Any
from abc import abstractmethod
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): ...
# TODO: this only satisfies the most common interface, where
# str is the raw form and unicode is the cooked form.
# In the long run, both should become template parameters maybe?
# There *are* str->str and unicode->unicode encodings in the standard library.
# And unlike python 3, they are in fairly widespread use.
_decoded = unicode
_encoded = str
# TODO: It is not possible to specify these signatures correctly, because
# they have an optional positional or keyword argument for errors=.
_encode_type = Callable[[_decoded], _encoded] # signature of Codec().encode
_decode_type = Callable[[_encoded], _decoded] # signature of Codec().decode
_stream_reader_type = Callable[[BinaryIO], 'StreamReader'] # signature of StreamReader __init__
_stream_writer_type = Callable[[BinaryIO], 'StreamWriter'] # signature of StreamWriter __init__
_incremental_encoder_type = Callable[[], 'IncrementalEncoder'] # signature of IncrementalEncoder __init__
_incremental_decode_type = Callable[[], 'IncrementalDecoder'] # signature of IncrementalDecoder __init__
def encode(obj: _decoded, encoding: str = 'utf-8', errors: str = 'strict') -> _encoded:
...
def decode(obj: _encoded, encoding: str = 'utf-8', errors: str = 'strict') -> _decoded:
...
def lookup(encoding: str) -> 'CodecInfo':
...
class CodecInfo(Tuple[_encode_type, _decode_type, _stream_reader_type, _stream_writer_type]):
def __init__(self, encode: _encode_type, decode: _decode_type, streamreader: _stream_reader_type = None, streamwriter: _stream_writer_type = None, incrementalencoder: _incremental_encoder_type = None, incrementaldecoder: _incremental_decode_type = None, name: str = None) -> None:
self.encode = encode
self.decode = decode
self.streamreader = streamreader
self.streamwriter = streamwriter
self.incrementalencoder = incrementalencoder
self.incrementaldecoder = incrementaldecoder
self.name = name
def getencoder(encoding: str) -> _encode_type:
...
def getdecoder(encoding: str) -> _encode_type:
...
def getincrementalencoder(encoding: str) -> _incremental_encoder_type:
...
def getincrementaldecoder(encoding: str) -> _incremental_encoder_type:
...
def getreader(encoding: str) -> _stream_reader_type:
...
def getwriter(encoding: str) -> _stream_writer_type:
...
def register(search_function: Callable[[str], CodecInfo]) -> None:
...
def open(filename: str, mode: str = 'r', encoding: str = None, errors: str = 'strict', buffering: int = 1) -> StreamReaderWriter:
...
def EncodedFile(file: BinaryIO, data_encoding: str, file_encoding: str = None, errors = 'strict') -> 'StreamRecoder':
...
def iterencode(iterator: Iterable[_decoded], encoding: str, errors: str = 'strict') -> Iterator[_encoded]:
...
def iterdecode(iterator: Iterable[_encoded], encoding: str, errors: str = 'strict') -> Iterator[_decoded]:
...
BOM = b''
BOM_BE = b''
BOM_LE = b''
BOM_UTF8 = b''
BOM_UTF16 = b''
BOM_UTF16_BE = b''
BOM_UTF16_LE = b''
BOM_UTF32 = b''
BOM_UTF32_BE = b''
BOM_UTF32_LE = b''
# It is expected that different actions be taken depending on which of the
# three subclasses of `UnicodeError` is actually ...ed. However, the Union
# is still needed for at least one of the cases.
def register_error(name: str, error_handler: Callable[[UnicodeError], Tuple[Union[str, bytes], int]]) -> None:
...
def lookup_error(name: str) -> Callable[[UnicodeError], Tuple[Union[str, bytes], int]]:
...
def strict_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]:
...
def replace_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]:
...
def ignore_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]:
...
def xmlcharrefreplace_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]:
...
def backslashreplace_errors(exception: UnicodeError) -> Tuple[Union[str, bytes], int]:
...
class Codec:
def encode(self, input, errors=''): ...
def decode(self, input, errors=''): ...
# These are sort of @abstractmethod but sort of not.
# The StreamReader and StreamWriter subclasses only implement one.
def encode(self, input: _decoded, errors: str = 'strict') -> Tuple[_encoded, int]:
...
def decode(self, input: _encoded, errors: str = 'strict') -> Tuple[_decoded, int]:
...
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): ...
def __init__(self, errors: str = 'strict') -> None:
self.errors = errors
@abstractmethod
def encode(self, object: _decoded, final: bool = False) -> _encoded:
...
def reset(self) -> None:
...
# documentation says int but str is needed for the subclass.
def getstate(self) -> Union[int, _decoded]:
...
def setstate(self, state: Union[int, _decoded]) -> None:
...
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): ...
def __init__(self, errors: str = 'strict') -> None:
self.errors = errors
@abstractmethod
def decode(self, object: _encoded, final: bool = False) -> _decoded:
...
def reset(self) -> None:
...
def getstate(self) -> Tuple[_encoded, int]:
...
def setstate(self, state: Tuple[_encoded, int]) -> None:
...
# These are not documented but used in encodings/*.py implementations.
class BufferedIncrementalEncoder(IncrementalEncoder):
def __init__(self, errors: str = 'strict') -> None:
IncrementalEncoder.__init__(self, errors)
self.buffer = ''
@abstractmethod
def _buffer_encode(self, input: _decoded, errors: str, final: bool) -> _encoded:
...
def encode(self, input: _decoded, final: bool = False) -> _encoded:
...
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): ...
def __init__(self, errors: str = 'strict') -> None:
IncrementalDecoder.__init__(self, errors)
self.buffer = b''
@abstractmethod
def _buffer_decode(self, input: _encoded, errors: str, final: bool) -> Tuple[_decoded, int]:
...
def decode(self, object: _encoded, final: bool = False) -> _decoded:
...
# TODO: it is not possible to specify the requirement that all other
# attributes and methods are passed-through from the stream.
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): ...
def __init__(self, stream: BinaryIO, errors: str = 'strict') -> None:
self.errors = errors
def write(self, obj: _decoded) -> None:
...
def writelines(self, list: List[str]) -> None:
...
def reset(self) -> None:
...
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): ...
def __init__(self, stream: BinaryIO, errors: str = 'strict') -> None:
self.errors = errors
def read(self, size: int = -1, chars: int = -1, firstline: bool = False) -> _decoded:
...
def readline(self, size: int = -1, keepends: bool = True) -> _decoded:
...
def readlines(self, sizehint: int = -1, keepends: bool = True) -> List[_decoded]:
...
def reset(self) -> None:
...
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): ...
def __init__(self, stream: BinaryIO, Reader: _stream_reader_type, Writer: _stream_writer_type, errors: str = 'strict') -> None:
...
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
class StreamRecoder(BinaryIO):
def __init__(self, stream: BinaryIO, encode: _encode_type, decode: _decode_type, Reader: _stream_reader_type, Writer: _stream_writer_type, errors: str = 'strict') -> None:
...

View File

@@ -0,0 +1,6 @@
import codecs
import typing
def search_function(encoding: str) -> codecs.CodecInfo:
...

View File

@@ -0,0 +1,14 @@
import codecs
class IncrementalEncoder(codecs.IncrementalEncoder):
pass
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
pass
class StreamWriter(codecs.StreamWriter):
pass
class StreamReader(codecs.StreamReader):
pass
def getregentry() -> codecs.CodecInfo: pass
def encode(input: str, errors: str = 'strict') -> bytes: pass
def decode(input: bytes, errors: str = 'strict') -> str: pass

View File

@@ -3,14 +3,14 @@
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from abc import ABCMeta, abstractmethod
from typing import Any, Callable, Dict, Sequence
from typing import Any, Callable, Dict, Iterator, Optional, Sequence, Tuple, TypeVar
from collections import namedtuple
_AnyCallable = Callable[..., Any]
_T = TypeVar("T")
_T = TypeVar("_T")
def reduce(function: Callable[[_T], _T],
sequence: Iterator[_T], initial=Optional[_T]) -> _T: ...
sequence: Iterator[_T], initial: Optional[_T] = None) -> _T: ...
WRAPPER_ASSIGNMENTS = ... # type: Sequence[str]
WRAPPER_UPDATES = ... # type: Sequence[str]
@@ -19,11 +19,11 @@ def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Seque
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): ...
def cmp_to_key(mycmp: Callable[[_T, _T], bool]) -> Callable[[_T], Any]: ...
class partial(object):
func = ... # Callable[..., Any]
args = ... # type: Tuple[Any]
args = ... # type: Tuple[Any, ...]
keywords = ... # type: Dict[str, Any]
def __init__(self, func: Callable[..., Any], *args, **kwargs) -> None: ...
def __call__(self, *args, **kwargs) -> Any: ...
def __init__(self, func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...

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

@@ -0,0 +1,3 @@
# Stubs for httplib (incomplete)
class HTTPException(Exception): ...

View File

@@ -51,7 +51,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
def doRollover(self): ...
class WatchedFileHandler(logging.FileHandler):
def __init__(self, filename: str, mode: str = ..., encoding: str = None, delay: int = ...): ...
def __init__(self, filename: str, mode: str = ..., encoding: str = None, delay: int = ...) -> None: ...
stream = ... # type: Any
def emit(self, record): ...

View File

@@ -17,8 +17,8 @@ _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 getstate(self) -> _random._State: ...
def setstate(self, state: _random._State) -> None: ...
def jumpahead(self, n : int) -> None: ...
def getrandbits(self, k: int) -> int: ...
@overload

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

@@ -0,0 +1,5 @@
# Stubs for ssl (incomplete)
import socket
class SSLError(socket.error): ...

62
stdlib/2.7/token.pyi Normal file
View File

@@ -0,0 +1,62 @@
from typing import Dict
ENDMARKER = 0
NAME = 0
NUMBER = 0
STRING = 0
NEWLINE = 0
INDENT = 0
DEDENT = 0
LPAR = 0
RPAR = 0
LSQB = 0
RSQB = 0
COLON = 0
COMMA = 0
SEMI = 0
PLUS = 0
MINUS = 0
STAR = 0
SLASH = 0
VBAR = 0
AMPER = 0
LESS = 0
GREATER = 0
EQUAL = 0
DOT = 0
PERCENT = 0
BACKQUOTE = 0
LBRACE = 0
RBRACE = 0
EQEQUAL = 0
NOTEQUAL = 0
LESSEQUAL = 0
GREATEREQUAL = 0
TILDE = 0
CIRCUMFLEX = 0
LEFTSHIFT = 0
RIGHTSHIFT = 0
DOUBLESTAR = 0
PLUSEQUAL = 0
MINEQUAL = 0
STAREQUAL = 0
SLASHEQUAL = 0
PERCENTEQUAL = 0
AMPEREQUAL = 0
VBAREQUAL = 0
CIRCUMFLEXEQUAL = 0
LEFTSHIFTEQUAL = 0
RIGHTSHIFTEQUAL = 0
DOUBLESTAREQUAL = 0
DOUBLESLASH = 0
DOUBLESLASHEQUAL = 0
AT = 0
OP = 0
ERRORTOKEN = 0
N_TOKENS = 0
NT_OFFSET = 0
tok_name = {} # type: Dict[int, str]
def ISTERMINAL(x) -> bool: ...
def ISNONTERMINAL(x) -> bool: ...
def ISEOF(x) -> bool: ...

View File

@@ -1,11 +1,11 @@
# Stubs for types
from typing import Any
from typing import Any, Tuple, Optional
class ModuleType:
__name__ = ... # type: str
__file__ = ... # type: str
def __init__(self, name: str, doc: Any) -> None: ...
def __init__(self, name: str, doc: str) -> None: ...
class TracebackType:
...
@@ -21,16 +21,16 @@ class ListType:
class CodeType:
co_argcount = ... # type: int
co_cellvars = ... # type: Tuple[str]
co_cellvars = ... # type: Tuple[str, ...]
co_code = ... # type: str
co_consts = ... # type: Tuple[Any]
co_consts = ... # type: Tuple[Any, ...]
co_filename = ... # type: Optional[str]
co_firstlineno = ... # type: int
co_flags = ... # type: int
co_freevars = ... # type: Tuple[str]
co_freevars = ... # type: Tuple[str, ...]
co_lnotab = ... # type: str
co_name = ... # type: str
co_names = ... # type: Tuple[str]
co_names = ... # type: Tuple[str, ...]
co_nlocals= ... # type: int
co_stacksize= ... # type: int
co_varnames = ... # type: Tuple[str]
co_varnames = ... # type: Tuple[str, ...]

View File

@@ -200,7 +200,7 @@ class IO(Iterable[AnyStr], Generic[AnyStr]):
@abstractmethod
def tell(self) -> int: ...
@abstractmethod
def truncate(self, size: int = ...) -> int: ...
def truncate(self, size: int = ...) -> Optional[int]: ...
@abstractmethod
def writable(self) -> bool: ...
# TODO buffer objects

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

@@ -0,0 +1,3 @@
# Stubs for unittest (2.7, incomplete)
class TestCase: ...

View File

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

View File

@@ -1,803 +0,0 @@
# Stubs for builtins (Python 3)
from typing import (
TypeVar, Iterator, Iterable, overload,
Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic,
Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsBytes,
SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString
)
from abc import abstractmethod, ABCMeta
# Note that names imported above are not automatically made visible via the
# implicit builtins import.
_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() # Only valid as a decorator.
classmethod = object() # 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__ = ''
__qualname__ = ''
__module__ = ''
__dict__ = ... # type: Dict[str, Any]
def __init__(self, o: object) -> None: ...
@staticmethod
def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ...
class int(SupportsInt, SupportsFloat, SupportsAbs[int]):
def __init__(self, x: Union[SupportsInt, str, bytes] = None, base: int = None) -> None: ...
def bit_length(self) -> int: ...
def to_bytes(self, length: int, byteorder: str, *, signed: bool = False) -> bytes: ...
@classmethod
def from_bytes(cls, bytes: Sequence[int], byteorder: str, *,
signed: bool = False) -> int: ... # TODO buffer object argument
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 __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 __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]):
def __init__(self, x: Union[SupportsFloat, str, bytes]=None) -> 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 __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 __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: ...
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 __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 __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 str(Sequence[str]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, o: object) -> None: ...
@overload
def __init__(self, o: bytes, encoding: str = None, errors: str = 'strict') -> None: ...
def capitalize(self) -> str: ...
def center(self, width: int, fillchar: str = ' ') -> str: ...
def count(self, x: str) -> int: ...
def encode(self, encoding: str = 'utf-8', errors: str = 'strict') -> bytes: ...
def endswith(self, suffix: Union[str, Tuple[str, ...]], start: int = None,
end: int = None) -> bool: ...
def expandtabs(self, tabsize: int = 8) -> str: ...
def find(self, sub: str, start: int = 0, end: int = 0) -> int: ...
def format(self, *args: Any, **kwargs: Any) -> str: ...
def format_map(self, map: Mapping[str, Any]) -> str: ...
def index(self, sub: str, 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[str]) -> str: ...
def ljust(self, width: int, fillchar: str = ' ') -> str: ...
def lower(self) -> str: ...
def lstrip(self, chars: str = None) -> str: ...
def partition(self, sep: str) -> Tuple[str, str, str]: ...
def replace(self, old: str, new: str, count: int = -1) -> str: ...
def rfind(self, sub: str, start: int = 0, end: int = 0) -> int: ...
def rindex(self, sub: str, start: int = 0, end: int = 0) -> int: ...
def rjust(self, width: int, fillchar: str = ' ') -> str: ...
def rpartition(self, sep: str) -> Tuple[str, str, str]: ...
def rsplit(self, sep: str = None, maxsplit: int = -1) -> List[str]: ...
def rstrip(self, chars: str = None) -> str: ...
def split(self, sep: str = None, maxsplit: int = -1) -> List[str]: ...
def splitlines(self, keepends: bool = False) -> List[str]: ...
def startswith(self, prefix: Union[str, Tuple[str, ...]], start: int = None,
end: int = None) -> bool: ...
def strip(self, chars: str = None) -> str: ...
def swapcase(self) -> str: ...
def title(self) -> str: ...
def translate(self, table: Dict[int, Any]) -> str: ...
def upper(self) -> str: ...
def zfill(self, width: int) -> str: ...
@staticmethod
@overload
def maketrans(self, x: Union[Dict[int, Any], Dict[str, Any]]) -> Dict[int, Any]: ...
@staticmethod
@overload
def maketrans(self, x: str, y: str, z: str = ...) -> Dict[int, Any]: ...
def __getitem__(self, i: Union[int, slice]) -> str: ...
def __add__(self, s: str) -> str: ...
def __mul__(self, n: int) -> str: ...
def __rmul__(self, n: int) -> str: ...
def __mod__(self, *args: Any) -> str: ...
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: ...
def __len__(self) -> int: ...
def __contains__(self, s: object) -> bool: ...
def __iter__(self) -> Iterator[str]: ...
def __str__(self) -> str: return self
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
class bytes(ByteString):
@overload
def __init__(self, ints: Iterable[int]) -> None: ...
@overload
def __init__(self, string: str, encoding: str,
errors: str = 'strict') -> None: ...
@overload
def __init__(self, length: int) -> None: ...
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, o: SupportsBytes) -> None: ...
def capitalize(self) -> bytes: ...
def center(self, width: int, fillchar: bytes = None) -> bytes: ...
def count(self, x: bytes) -> int: ...
def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ...
def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
def expandtabs(self, tabsize: int = 8) -> bytes: ...
def find(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def index(self, sub: bytes, 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[bytes]) -> bytes: ...
def ljust(self, width: int, fillchar: bytes = None) -> bytes: ...
def lower(self) -> bytes: ...
def lstrip(self, chars: bytes = None) -> bytes: ...
def partition(self, sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
def replace(self, old: bytes, new: bytes, count: int = -1) -> bytes: ...
def rfind(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rindex(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rjust(self, width: int, fillchar: bytes = None) -> bytes: ...
def rpartition(self, sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
def rsplit(self, sep: bytes = None, maxsplit: int = -1) -> List[bytes]: ...
def rstrip(self, chars: bytes = None) -> bytes: ...
def split(self, sep: bytes = None, maxsplit: int = -1) -> List[bytes]: ...
def splitlines(self, keepends: bool = False) -> List[bytes]: ...
def startswith(self, prefix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
def strip(self, chars: bytes = None) -> bytes: ...
def swapcase(self) -> bytes: ...
def title(self) -> bytes: ...
def translate(self, table: bytes) -> bytes: ...
def upper(self) -> bytes: ...
def zfill(self, width: int) -> bytes: ...
# TODO fromhex
# TODO maketrans
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) -> bytes: ...
def __add__(self, s: bytes) -> bytes: ...
def __mul__(self, n: int) -> bytes: ...
def __rmul__(self, n: int) -> bytes: ...
def __contains__(self, o: object) -> bool: ...
def __eq__(self, x: object) -> bool: ...
def __ne__(self, x: object) -> bool: ...
def __lt__(self, x: bytes) -> bool: ...
def __le__(self, x: bytes) -> bool: ...
def __gt__(self, x: bytes) -> bool: ...
def __ge__(self, x: bytes) -> bool: ...
class bytearray(MutableSequence[int], ByteString):
@overload
def __init__(self, ints: Iterable[int]) -> None: ...
@overload
def __init__(self, string: str, encoding: str, errors: str = 'strict') -> None: ...
@overload
def __init__(self, length: int) -> None: ...
@overload
def __init__(self) -> None: ...
def capitalize(self) -> bytearray: ...
def center(self, width: int, fillchar: bytes = None) -> bytearray: ...
def count(self, x: bytes) -> int: ...
def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ...
def endswith(self, suffix: bytes) -> bool: ...
def expandtabs(self, tabsize: int = 8) -> bytearray: ...
def find(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def index(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def insert(self, index: int, object: int) -> None: ...
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[bytes]) -> bytearray: ...
def ljust(self, width: int, fillchar: bytes = None) -> bytearray: ...
def lower(self) -> bytearray: ...
def lstrip(self, chars: bytes = None) -> bytearray: ...
def partition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def replace(self, old: bytes, new: bytes, count: int = -1) -> bytearray: ...
def rfind(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rindex(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rjust(self, width: int, fillchar: bytes = None) -> bytearray: ...
def rpartition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def rsplit(self, sep: bytes = None, maxsplit: int = -1) -> List[bytearray]: ...
def rstrip(self, chars: bytes = None) -> bytearray: ...
def split(self, sep: bytes = None, maxsplit: int = -1) -> List[bytearray]: ...
def splitlines(self, keepends: bool = False) -> List[bytearray]: ...
def startswith(self, prefix: bytes) -> bool: ...
def strip(self, chars: bytes = None) -> bytearray: ...
def swapcase(self) -> bytearray: ...
def title(self) -> bytearray: ...
def translate(self, table: bytes) -> bytearray: ...
def upper(self) -> bytearray: ...
def zfill(self, width: int) -> bytearray: ...
# TODO fromhex
# TODO maketrans
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: ...
@overload
def __setitem__(self, i: int, x: int) -> None: ...
@overload
def __setitem__(self, s: slice, x: Sequence[int]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __add__(self, s: bytes) -> bytearray: ...
# TODO: Mypy complains about __add__ and __iadd__ having different signatures.
def __iadd__(self, s: Iterable[int]) -> bytearray: ... # type: ignore
def __mul__(self, n: int) -> bytearray: ...
def __rmul__(self, n: int) -> bytearray: ...
def __imul__(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: bytes) -> bool: ...
def __le__(self, x: bytes) -> bool: ...
def __gt__(self, x: bytes) -> bool: ...
def __ge__(self, x: bytes) -> bool: ...
class memoryview():
# TODO arg can be any obj supporting the buffer protocol
def __init__(self, bytearray) -> None: ...
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 = 0, step: int = 0) -> 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 not defined in builtins!
__name__ = ''
__qualname__ = ''
__module__ = ''
__code__ = ... # type: Any
class list(MutableSequence[_T], Reversible[_T], Generic[_T]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T]) -> None: ...
def clear(self) -> None: ...
def copy(self) -> List[_T]: ...
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] = None, 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]: ...
@overload
def __setitem__(self, i: int, o: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: Sequence[_T]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __add__(self, x: List[_T]) -> List[_T]: ...
def __iadd__(self, x: Iterable[_T]) -> List[_T]: ...
def __mul__(self, n: int) -> List[_T]: ...
def __rmul__(self, n: int) -> List[_T]: ...
def __imul__(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 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 = None) -> _VT: ...
def popitem(self) -> Tuple[_KT, _VT]: ...
def setdefault(self, k: _KT, default: _VT = None) -> _VT: ...
def update(self, m: Union[Mapping[_KT, _VT],
Iterable[Tuple[_KT, _VT]]]) -> None: ...
def keys(self) -> KeysView[_KT]: ...
def values(self) -> ValuesView[_VT]: ...
def items(self) -> ItemsView[_KT, _VT]: ...
@staticmethod
@overload
def fromkeys(seq: Sequence[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method
@staticmethod
@overload
def fromkeys(seq: Sequence[_T], value: _S) -> Dict[_T, _S]: ...
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]):
def __init__(self, iterable: Iterable[_T]=None) -> None: ...
def add(self, element: _T) -> None: ...
def clear(self) -> None: ...
def copy(self) -> set[_T]: ...
def difference(self, s: Iterable[Any]) -> set[_T]: ...
def difference_update(self, s: Iterable[Any]) -> None: ...
def discard(self, element: _T) -> None: ...
def intersection(self, s: Iterable[Any]) -> set[_T]: ...
def intersection_update(self, s: Iterable[Any]) -> None: ...
def isdisjoint(self, s: AbstractSet[Any]) -> bool: ...
def issubset(self, s: AbstractSet[Any]) -> bool: ...
def issuperset(self, s: AbstractSet[Any]) -> bool: ...
def pop(self) -> _T: ...
def remove(self, element: _T) -> None: ...
def symmetric_difference(self, s: Iterable[_T]) -> set[_T]: ...
def symmetric_difference_update(self, s: Iterable[_T]) -> None: ...
def union(self, s: Iterable[_T]) -> set[_T]: ...
def update(self, s: Iterable[_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[Any]) -> set[_T]: ...
def __iand__(self, s: AbstractSet[Any]) -> set[_T]: ...
def __or__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __ior__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __sub__(self, s: AbstractSet[Any]) -> set[_T]: ...
def __isub__(self, s: AbstractSet[Any]) -> set[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __ixor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __le__(self, s: AbstractSet[Any]) -> bool: ...
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
# TODO more set operations
class frozenset(AbstractSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T]=None) -> None: ...
def copy(self) -> frozenset[_T]: ...
def difference(self, s: AbstractSet[Any]) -> frozenset[_T]: ...
def intersection(self, s: AbstractSet[Any]) -> frozenset[_T]: ...
def isdisjoint(self, s: AbstractSet[_T]) -> bool: ...
def issubset(self, s: AbstractSet[Any]) -> bool: ...
def issuperset(self, s: AbstractSet[Any]) -> bool: ...
def symmetric_difference(self, s: AbstractSet[_T]) -> frozenset[_T]: ...
def union(self, s: AbstractSet[_T]) -> frozenset[_T]: ...
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]]: ...
def __le__(self, s: AbstractSet[Any]) -> bool: ...
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
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 range(Sequence[int], Reversible[int]):
@overload
def __init__(self, stop: int) -> None: ...
@overload
def __init__(self, start: int, stop: int, step: int = 1) -> None: ...
def count(self, value: int) -> int: ...
def index(self, value: int, start: int = 0, stop: int = None) -> int: ...
def __len__(self) -> int: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[int]: ...
@overload
def __getitem__(self, i: int) -> int: ...
@overload
def __getitem__(self, s: slice) -> range: ...
def __repr__(self) -> str: ...
def __reversed__(self) -> Iterator[int]: ...
class module:
# TODO not defined in builtins!
__name__ = ''
__file__ = ''
__dict__ = ... # type: Dict[str, Any]
True = ... # type: bool
False = ... # type: bool
__debug__ = False
NotImplemented = ... # type: Any
def abs(n: SupportsAbs[_T]) -> _T: ...
def all(i: Iterable) -> bool: ...
def any(i: Iterable) -> bool: ...
def ascii(o: object) -> str: ...
def bin(number: int) -> str: ...
def callable(o: object) -> bool: ...
def chr(code: int) -> str: ...
def compile(source: Any, filename: Union[str, bytes], mode: str, flags: int = 0,
dont_inherit: int = 0) -> Any: ...
def copyright() -> None: ...
def credits() -> None: ...
def delattr(o: Any, name: str) -> None: ...
def dir(o: object = None) -> List[str]: ...
_N = TypeVar('_N', int, float)
def divmod(a: _N, b: _N) -> Tuple[_N, _N]: ...
def eval(source: str, globals: Dict[str, Any] = None,
locals: Mapping[str, Any] = None) -> Any: ... # TODO code object as source
def exec(object: str, globals: Dict[str, Any] = None,
locals: Mapping[str, Any] = None) -> Any: ... # TODO code object as source
def exit(code: int = None) -> None: ...
def filter(function: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ...
def format(o: object, format_spec: str = '') -> str: ...
def getattr(o: Any, name: str, default: Any = None) -> Any: ...
def globals() -> Dict[str, Any]: ...
def hasattr(o: Any, name: str) -> bool: ...
def hash(o: object) -> int: ...
def help(*args: Any, **kwds: Any) -> None: ...
def hex(i: int) -> str: ... # TODO __index__
def id(o: object) -> int: ...
def input(prompt: str = None) -> 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: Union[Sized, tuple]) -> int: ...
def license() -> None: ...
def locals() -> Dict[str, Any]: ...
@overload
def map(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ...
@overload
def map(func: Callable[[_T1, _T2], _S], iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterator[_S]: ... # TODO more than two iterables
@overload
def max(iterable: Iterable[_T]) -> _T: ... # TODO keyword argument key
@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__
def open(file: Union[str, bytes, int], mode: str = 'r', buffering: int = -1, encoding: str = None,
errors: str = None, newline: str = None, closefd: bool = True) -> IO[Any]: ...
def ord(c: Union[str, bytes, bytearray]) -> int: ...
def print(*values: Any, sep: str = ' ', end: str = '\n', file: IO[str] = None) -> 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) -> None: ...
@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: str, value: Any) -> None: ...
def sorted(iterable: Iterable[_T], *, key: Callable[[_T], Any] = None,
reverse: bool = False) -> List[_T]: ...
def sum(iterable: Iterable[_T], start: _T = None) -> _T: ...
def vars(object: Any = None) -> Dict[str, Any]: ...
@overload
def zip(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2,
_T3, _T4]]: ... # TODO more than four iterables
def __import__(name: str, globals: Dict[str, Any] = {}, locals: Dict[str, Any] = {},
fromlist: List[str] = [], level: int = -1) -> Any: ...
# Ellipsis
class ellipsis:
# TODO not defined in builtins!
def __init__(self) -> None: ...
Ellipsis = ellipsis()
# Exceptions
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 ArithmeticError(Exception): ...
class EnvironmentError(Exception):
errno = 0
strerror = ''
filename = '' # TODO can this be bytes?
class LookupError(Exception): ...
class RuntimeError(Exception): ...
class ValueError(Exception): ...
class AssertionError(Exception): ...
class AttributeError(Exception): ...
class BufferError(Exception): ...
class EOFError(Exception): ...
class FloatingPointError(ArithmeticError): ...
class IOError(EnvironmentError): ...
class ImportError(Exception): ...
class IndexError(LookupError): ...
class KeyError(LookupError): ...
class MemoryError(Exception): ...
class NameError(Exception): ...
class NotImplementedError(RuntimeError): ...
class OSError(EnvironmentError): ...
class BlockingIOError(OSError):
characters_written = 0
class ChildProcessError(OSError): ...
class ConnectionError(OSError): ...
class BrokenPipeError(ConnectionError): ...
class ConnectionAbortedError(ConnectionError): ...
class ConnectionRefusedError(ConnectionError): ...
class ConnectionResetError(ConnectionError): ...
class FileExistsError(OSError): ...
class FileNotFoundError(OSError): ...
class InterruptedError(OSError): ...
class IsADirectoryError(OSError): ...
class NotADirectoryError(OSError): ...
class PermissionError(OSError): ...
class ProcessLookupError(OSError): ...
class TimeoutError(OSError): ...
class WindowsError(OSError): ...
class OverflowError(ArithmeticError): ...
class ReferenceError(Exception): ...
class StopIteration(Exception): ...
class SyntaxError(Exception): ...
class IndentationError(SyntaxError): ...
class TabError(IndentationError): ...
class SystemError(Exception): ...
class TypeError(Exception): ...
class UnboundLocalError(NameError): ...
class UnicodeError(ValueError): ...
class UnicodeDecodeError(UnicodeError):
encoding = ... # type: str
object = ... # type: bytes
start = ... # type: int
end = ... # type: int
reason = ... # type: str
def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int,
__reason: str) -> None: ...
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): ...

View File

@@ -12,4 +12,3 @@ class StreamReader(codecs.StreamReader):
def getregentry() -> codecs.CodecInfo: pass
def encode(input: str, errors: str = 'strict') -> bytes: pass
def decode(input: bytes, errors: str = 'strict') -> str: pass

View File

@@ -1,9 +1,35 @@
# Stubs for platform
# Stubs for platform (Python 3.5)
# NOTE: These are incomplete!
from typing import Tuple, NamedTuple
from typing import Tuple
from os import devnull as DEV_NULL
def mac_ver(release: str = '',
version_info: Tuple[str, str, str] = ('', '', ''),
machine: str = '') -> Tuple[str, Tuple[str, str, str], str]: ...
def libc_ver(executable: str = ..., lib: str = '', version: str = '', chunksize: int = 16384) -> Tuple[str, str]: ...
def linux_distribution(distname: str = '', version: str = '', id: str = '', supported_dists: Tuple[str, ...] = ..., full_distribution_name: bool = True) -> Tuple[str, str, str]: ...
def dist(distname: str = '', version: str = '', id: str = '', supported_dists: Tuple[str, ...] = ...) -> Tuple[str, str, str]: ...
from os import popen
def win32_ver(release: str = '', version: str = '', csd: str = '', ptype: str = '') -> Tuple[str, str, str, str]: ...
def mac_ver(release: str = '', versioninfo: Tuple[str, str, str] = ..., machine: str = '') -> Tuple[str, Tuple[str, str, str], str]: ...
def java_ver(release: str = '', vendor: str = '', vminfo: Tuple[str, str, str] = ..., osinfo: Tuple[str, str, str] = ...) -> Tuple[str, str, Tuple[str, str, str], Tuple[str, str, str]]: ...
def system_alias(system: str, release: str, version: str) -> Tuple[str, str, str]: ...
def architecture(executable: str = ..., bits: str = '', linkage: str = '') -> Tuple[str, str]: ...
uname_result = NamedTuple('uname_result', [('system', str), ('node', str), ('release', str), ('version', str), ('machine', str), ('processor', str)])
def uname() -> uname_result: ...
def system() -> str: ...
def node() -> str: ...
def release() -> str: ...
def version() -> str: ...
def machine() -> str: ...
def processor() -> str: ...
def python_implementation() -> str: ...
def python_version() -> str: ...
def python_version_tuple() -> Tuple[str, str, str]: ...
def python_branch() -> str: ...
def python_revision() -> str: ...
def python_build() -> Tuple[str, str]: ...
def python_compiler() -> str: ...
def platform(aliased: bool = False, terse: bool = False) -> str: ...

View File

@@ -20,15 +20,15 @@ class CodeType:
co_stacksize = ... # type: int
co_flags = ... # type: int
co_code = ... # type: bytes
co_consts = ... # type: Tuple[Any]
co_names = ... # type: Tuple[str]
co_varnames = ... # type: Tuple[str]
co_consts = ... # type: Tuple[Any, ...]
co_names = ... # type: Tuple[str, ...]
co_varnames = ... # type: Tuple[str, ...]
co_filename = ... # type: Optional[str]
co_name = ... # type: str
co_firstlineno = ... # type: int
co_lnotab = ... # type: bytes
co_freevars = ... # type: Tuple[str]
co_cellvars = ... # type: Tuple[str]
co_freevars = ... # type: Tuple[str, ...]
co_cellvars = ... # type: Tuple[str, ...]
def __init__(self,
argcount: int,
kwonlyargcount: int,
@@ -36,15 +36,15 @@ class CodeType:
stacksize: int,
flags: int,
codestring: bytes,
constants: Sequence[Any],
names: Sequence[str],
varnames: Sequence[str],
constants: Tuple[Any, ...],
names: Tuple[str, ...],
varnames: Tuple[str, ...],
filename: str,
name: str,
firstlineno: int,
lnotab: bytes,
freevars: Sequence[str] = (),
cellvars: Sequence[str] = (),
freevars: Tuple[str, ...] = (),
cellvars: Tuple[str, ...] = (),
) -> None: ...
class FrameType: