1 # NB: __builtin__.pyi and builtins.pyi must remain consistent!
\r
2 # Stubs for builtins (Python 2.7)
\r
4 # True and False are deliberately omitted because they are keywords in
\r
5 # Python 3, and stub files conform to Python 3 syntax.
\r
8 TypeVar, Iterator, Iterable, NoReturn, overload,
\r
9 Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set,
\r
10 AbstractSet, FrozenSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
\r
11 SupportsComplex, SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping,
\r
12 MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, Type
\r
14 from abc import abstractmethod, ABCMeta
\r
17 _T_co = TypeVar('_T_co', covariant=True)
\r
18 _KT = TypeVar('_KT')
\r
19 _VT = TypeVar('_VT')
\r
21 _T1 = TypeVar('_T1')
\r
22 _T2 = TypeVar('_T2')
\r
23 _T3 = TypeVar('_T3')
\r
24 _T4 = TypeVar('_T4')
\r
25 _T5 = TypeVar('_T5')
\r
26 _TT = TypeVar('_TT', bound='type')
\r
29 __doc__ = ... # type: Optional[str]
\r
30 __class__ = ... # type: type
\r
31 __dict__ = ... # type: Dict[str, Any]
\r
32 __slots__ = ... # type: Union[str, unicode, Iterable[Union[str, unicode]]]
\r
33 __module__ = ... # type: str
\r
35 def __init__(self) -> None: ...
\r
36 def __new__(cls) -> Any: ...
\r
37 def __setattr__(self, name: str, value: Any) -> None: ...
\r
38 def __eq__(self, o: object) -> bool: ...
\r
39 def __ne__(self, o: object) -> bool: ...
\r
40 def __str__(self) -> str: ...
\r
41 def __repr__(self) -> str: ...
\r
42 def __hash__(self) -> int: ...
\r
43 def __format__(self, format_spec: str) -> str: ...
\r
44 def __getattribute__(self, name: str) -> Any: ...
\r
45 def __delattr__(self, name: str) -> None: ...
\r
46 def __sizeof__(self) -> int: ...
\r
47 def __reduce__(self) -> tuple: ...
\r
48 def __reduce_ex__(self, protocol: int) -> tuple: ...
\r
50 class staticmethod(object): # Special, only valid as a decorator.
\r
51 __func__ = ... # type: function
\r
53 def __init__(self, f: function) -> None: ...
\r
54 def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
\r
55 def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
\r
57 class classmethod(object): # Special, only valid as a decorator.
\r
58 __func__ = ... # type: function
\r
60 def __init__(self, f: function) -> None: ...
\r
61 def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
\r
62 def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
\r
65 __bases__ = ... # type: Tuple[type, ...]
\r
66 __name__ = ... # type: str
\r
67 __module__ = ... # type: str
\r
70 def __init__(self, o: object) -> None: ...
\r
72 def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any]) -> None: ...
\r
73 # TODO: __new__ may have to be special and not a static method.
\r
75 def __new__(cls, o: object) -> type: ...
\r
77 def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ...
\r
78 def __call__(self, *args: Any, **kwds: Any) -> Any: ...
\r
80 # Only new-style classes
\r
81 __mro__ = ... # type: Tuple[type, ...]
\r
82 # Note: the documentation doesnt specify what the return type is, the standard
\r
83 # implementation seems to be returning a list.
\r
84 def mro(self) -> List[type]: ...
\r
85 def __subclasses__(self: _TT) -> List[_TT]: ...
\r
86 def __instancecheck__(self, instance: Any) -> bool: ...
\r
87 def __subclasscheck__(self, subclass: type) -> bool: ...
\r
91 def __init__(self, x: SupportsInt = ...) -> None: ...
\r
93 def __init__(self, x: Union[str, unicode, bytearray], base: int = ...) -> None: ...
\r
95 def bit_length(self) -> int: ...
\r
97 def __add__(self, x: int) -> int: ...
\r
98 def __sub__(self, x: int) -> int: ...
\r
99 def __mul__(self, x: int) -> int: ...
\r
100 def __floordiv__(self, x: int) -> int: ...
\r
101 def __div__(self, x: int) -> int: ...
\r
102 def __truediv__(self, x: int) -> float: ...
\r
103 def __mod__(self, x: int) -> int: ...
\r
104 def __divmod__(self, x: int) -> Tuple[int, int]: ...
\r
105 def __radd__(self, x: int) -> int: ...
\r
106 def __rsub__(self, x: int) -> int: ...
\r
107 def __rmul__(self, x: int) -> int: ...
\r
108 def __rfloordiv__(self, x: int) -> int: ...
\r
109 def __rdiv__(self, x: int) -> int: ...
\r
110 def __rtruediv__(self, x: int) -> float: ...
\r
111 def __rmod__(self, x: int) -> int: ...
\r
112 def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
\r
113 def __pow__(self, x: int) -> Any: ... # Return type can be int or float, depending on x.
\r
114 def __rpow__(self, x: int) -> Any: ...
\r
115 def __and__(self, n: int) -> int: ...
\r
116 def __or__(self, n: int) -> int: ...
\r
117 def __xor__(self, n: int) -> int: ...
\r
118 def __lshift__(self, n: int) -> int: ...
\r
119 def __rshift__(self, n: int) -> int: ...
\r
120 def __rand__(self, n: int) -> int: ...
\r
121 def __ror__(self, n: int) -> int: ...
\r
122 def __rxor__(self, n: int) -> int: ...
\r
123 def __rlshift__(self, n: int) -> int: ...
\r
124 def __rrshift__(self, n: int) -> int: ...
\r
125 def __neg__(self) -> int: ...
\r
126 def __pos__(self) -> int: ...
\r
127 def __invert__(self) -> int: ...
\r
129 def __eq__(self, x: object) -> bool: ...
\r
130 def __ne__(self, x: object) -> bool: ...
\r
131 def __lt__(self, x: int) -> bool: ...
\r
132 def __le__(self, x: int) -> bool: ...
\r
133 def __gt__(self, x: int) -> bool: ...
\r
134 def __ge__(self, x: int) -> bool: ...
\r
136 def __str__(self) -> str: ...
\r
137 def __float__(self) -> float: ...
\r
138 def __int__(self) -> int: ...
\r
139 def __abs__(self) -> int: ...
\r
140 def __hash__(self) -> int: ...
\r
141 def __nonzero__(self) -> bool: ...
\r
144 def __init__(self, x: Union[SupportsFloat, str, unicode, bytearray] = ...) -> None: ...
\r
145 def as_integer_ratio(self) -> Tuple[int, int]: ...
\r
146 def hex(self) -> str: ...
\r
147 def is_integer(self) -> bool: ...
\r
149 def fromhex(cls, s: str) -> float: ...
\r
151 def __add__(self, x: float) -> float: ...
\r
152 def __sub__(self, x: float) -> float: ...
\r
153 def __mul__(self, x: float) -> float: ...
\r
154 def __floordiv__(self, x: float) -> float: ...
\r
155 def __div__(self, x: float) -> float: ...
\r
156 def __truediv__(self, x: float) -> float: ...
\r
157 def __mod__(self, x: float) -> float: ...
\r
158 def __divmod__(self, x: float) -> Tuple[float, float]: ...
\r
159 def __pow__(self, x: float) -> float: ...
\r
160 def __radd__(self, x: float) -> float: ...
\r
161 def __rsub__(self, x: float) -> float: ...
\r
162 def __rmul__(self, x: float) -> float: ...
\r
163 def __rfloordiv__(self, x: float) -> float: ...
\r
164 def __rdiv__(self, x: float) -> float: ...
\r
165 def __rtruediv__(self, x: float) -> float: ...
\r
166 def __rmod__(self, x: float) -> float: ...
\r
167 def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
\r
168 def __rpow__(self, x: float) -> float: ...
\r
170 def __eq__(self, x: object) -> bool: ...
\r
171 def __ne__(self, x: object) -> bool: ...
\r
172 def __lt__(self, x: float) -> bool: ...
\r
173 def __le__(self, x: float) -> bool: ...
\r
174 def __gt__(self, x: float) -> bool: ...
\r
175 def __ge__(self, x: float) -> bool: ...
\r
176 def __neg__(self) -> float: ...
\r
177 def __pos__(self) -> float: ...
\r
179 def __str__(self) -> str: ...
\r
180 def __int__(self) -> int: ...
\r
181 def __float__(self) -> float: ...
\r
182 def __abs__(self) -> float: ...
\r
183 def __hash__(self) -> int: ...
\r
184 def __nonzero__(self) -> bool: ...
\r
188 def __init__(self, re: float = ..., im: float = ...) -> None: ...
\r
190 def __init__(self, s: str) -> None: ...
\r
192 def __init__(self, s: SupportsComplex) -> None: ...
\r
195 def real(self) -> float: ...
\r
197 def imag(self) -> float: ...
\r
199 def conjugate(self) -> complex: ...
\r
201 def __add__(self, x: complex) -> complex: ...
\r
202 def __sub__(self, x: complex) -> complex: ...
\r
203 def __mul__(self, x: complex) -> complex: ...
\r
204 def __pow__(self, x: complex) -> complex: ...
\r
205 def __div__(self, x: complex) -> complex: ...
\r
206 def __truediv__(self, x: complex) -> complex: ...
\r
207 def __radd__(self, x: complex) -> complex: ...
\r
208 def __rsub__(self, x: complex) -> complex: ...
\r
209 def __rmul__(self, x: complex) -> complex: ...
\r
210 def __rpow__(self, x: complex) -> complex: ...
\r
211 def __rdiv__(self, x: complex) -> complex: ...
\r
212 def __rtruediv__(self, x: complex) -> complex: ...
\r
214 def __eq__(self, x: object) -> bool: ...
\r
215 def __ne__(self, x: object) -> bool: ...
\r
216 def __neg__(self) -> complex: ...
\r
217 def __pos__(self) -> complex: ...
\r
219 def __complex__(self) -> complex: ...
\r
220 def __str__(self) -> str: ...
\r
221 def __abs__(self) -> float: ...
\r
222 def __hash__(self) -> int: ...
\r
223 def __nonzero__(self) -> bool: ...
\r
225 class super(object):
\r
227 def __init__(self, t: Any, obj: Any) -> None: ...
\r
229 def __init__(self, t: Any) -> None: ...
\r
231 class basestring(metaclass=ABCMeta): ...
\r
233 class unicode(basestring, Sequence[unicode]):
\r
235 def __init__(self) -> None: ...
\r
237 def __init__(self, o: object) -> None: ...
\r
239 def __init__(self, o: str, encoding: unicode = ..., errors: unicode = ...) -> None: ...
\r
240 def capitalize(self) -> unicode: ...
\r
241 def center(self, width: int, fillchar: unicode = ...) -> unicode: ...
\r
242 def count(self, x: unicode) -> int: ...
\r
243 def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ...
\r
244 def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ...
\r
245 def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]], start: int = ...,
\r
246 end: int = ...) -> bool: ...
\r
247 def expandtabs(self, tabsize: int = ...) -> unicode: ...
\r
248 def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
\r
249 def format(self, *args: Any, **kwargs: Any) -> unicode: ...
\r
250 def format_map(self, map: Mapping[unicode, Any]) -> unicode: ...
\r
251 def index(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
\r
252 def isalnum(self) -> bool: ...
\r
253 def isalpha(self) -> bool: ...
\r
254 def isdecimal(self) -> bool: ...
\r
255 def isdigit(self) -> bool: ...
\r
256 def isidentifier(self) -> bool: ...
\r
257 def islower(self) -> bool: ...
\r
258 def isnumeric(self) -> bool: ...
\r
259 def isprintable(self) -> bool: ...
\r
260 def isspace(self) -> bool: ...
\r
261 def istitle(self) -> bool: ...
\r
262 def isupper(self) -> bool: ...
\r
263 def join(self, iterable: Iterable[unicode]) -> unicode: ...
\r
264 def ljust(self, width: int, fillchar: unicode = ...) -> unicode: ...
\r
265 def lower(self) -> unicode: ...
\r
266 def lstrip(self, chars: unicode = ...) -> unicode: ...
\r
267 def partition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
\r
268 def replace(self, old: unicode, new: unicode, count: int = ...) -> unicode: ...
\r
269 def rfind(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
\r
270 def rindex(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
\r
271 def rjust(self, width: int, fillchar: unicode = ...) -> unicode: ...
\r
272 def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
\r
273 def rsplit(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ...
\r
274 def rstrip(self, chars: unicode = ...) -> unicode: ...
\r
275 def split(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ...
\r
276 def splitlines(self, keepends: bool = ...) -> List[unicode]: ...
\r
277 def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]], start: int = ...,
\r
278 end: int = ...) -> bool: ...
\r
279 def strip(self, chars: unicode = ...) -> unicode: ...
\r
280 def swapcase(self) -> unicode: ...
\r
281 def title(self) -> unicode: ...
\r
282 def translate(self, table: Union[Dict[int, Any], unicode]) -> unicode: ...
\r
283 def upper(self) -> unicode: ...
\r
284 def zfill(self, width: int) -> unicode: ...
\r
287 def __getitem__(self, i: int) -> unicode: ...
\r
289 def __getitem__(self, s: slice) -> unicode: ...
\r
290 def __getslice__(self, start: int, stop: int) -> unicode: ...
\r
291 def __add__(self, s: unicode) -> unicode: ...
\r
292 def __mul__(self, n: int) -> unicode: ...
\r
293 def __rmul__(self, n: int) -> unicode: ...
\r
294 def __mod__(self, x: Any) -> unicode: ...
\r
295 def __eq__(self, x: object) -> bool: ...
\r
296 def __ne__(self, x: object) -> bool: ...
\r
297 def __lt__(self, x: unicode) -> bool: ...
\r
298 def __le__(self, x: unicode) -> bool: ...
\r
299 def __gt__(self, x: unicode) -> bool: ...
\r
300 def __ge__(self, x: unicode) -> bool: ...
\r
302 def __len__(self) -> int: ...
\r
303 def __contains__(self, s: object) -> bool: ...
\r
304 def __iter__(self) -> Iterator[unicode]: ...
\r
305 def __str__(self) -> str: ...
\r
306 def __repr__(self) -> str: ...
\r
307 def __int__(self) -> int: ...
\r
308 def __float__(self) -> float: ...
\r
309 def __hash__(self) -> int: ...
\r
311 class str(basestring, Sequence[str]):
\r
312 def __init__(self, object: object = ...) -> None: ...
\r
313 def capitalize(self) -> str: ...
\r
314 def center(self, width: int, fillchar: str = ...) -> str: ...
\r
315 def count(self, x: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
\r
316 def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ...
\r
317 def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ...
\r
318 def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]]) -> bool: ...
\r
319 def expandtabs(self, tabsize: int = ...) -> str: ...
\r
320 def find(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
\r
321 def format(self, *args: Any, **kwargs: Any) -> str: ...
\r
322 def index(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
\r
323 def isalnum(self) -> bool: ...
\r
324 def isalpha(self) -> bool: ...
\r
325 def isdigit(self) -> bool: ...
\r
326 def islower(self) -> bool: ...
\r
327 def isspace(self) -> bool: ...
\r
328 def istitle(self) -> bool: ...
\r
329 def isupper(self) -> bool: ...
\r
330 def join(self, iterable: Iterable[AnyStr]) -> AnyStr: ...
\r
331 def ljust(self, width: int, fillchar: str = ...) -> str: ...
\r
332 def lower(self) -> str: ...
\r
334 def lstrip(self, chars: str = ...) -> str: ...
\r
336 def lstrip(self, chars: unicode) -> unicode: ...
\r
338 def partition(self, sep: bytearray) -> Tuple[str, bytearray, str]: ...
\r
340 def partition(self, sep: str) -> Tuple[str, str, str]: ...
\r
342 def partition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
\r
343 def replace(self, old: AnyStr, new: AnyStr, count: int = ...) -> AnyStr: ...
\r
344 def rfind(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
\r
345 def rindex(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
\r
346 def rjust(self, width: int, fillchar: str = ...) -> str: ...
\r
348 def rpartition(self, sep: bytearray) -> Tuple[str, bytearray, str]: ...
\r
350 def rpartition(self, sep: str) -> Tuple[str, str, str]: ...
\r
352 def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
\r
354 def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
\r
356 def rsplit(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
\r
358 def rstrip(self, chars: str = ...) -> str: ...
\r
360 def rstrip(self, chars: unicode) -> unicode: ...
\r
362 def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
\r
364 def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
\r
365 def splitlines(self, keepends: bool = ...) -> List[str]: ...
\r
366 def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]]) -> bool: ...
\r
368 def strip(self, chars: str = ...) -> str: ...
\r
370 def strip(self, chars: unicode) -> unicode: ...
\r
371 def swapcase(self) -> str: ...
\r
372 def title(self) -> str: ...
\r
373 def translate(self, table: Optional[AnyStr], deletechars: AnyStr = ...) -> AnyStr: ...
\r
374 def upper(self) -> str: ...
\r
375 def zfill(self, width: int) -> str: ...
\r
377 def __len__(self) -> int: ...
\r
378 def __iter__(self) -> Iterator[str]: ...
\r
379 def __str__(self) -> str: ...
\r
380 def __repr__(self) -> str: ...
\r
381 def __int__(self) -> int: ...
\r
382 def __float__(self) -> float: ...
\r
383 def __hash__(self) -> int: ...
\r
385 def __getitem__(self, i: int) -> str: ...
\r
387 def __getitem__(self, s: slice) -> str: ...
\r
388 def __getslice__(self, start: int, stop: int) -> str: ...
\r
389 def __add__(self, s: AnyStr) -> AnyStr: ...
\r
390 def __mul__(self, n: int) -> str: ...
\r
391 def __rmul__(self, n: int) -> str: ...
\r
392 def __contains__(self, o: object) -> bool: ...
\r
393 def __eq__(self, x: object) -> bool: ...
\r
394 def __ne__(self, x: object) -> bool: ...
\r
395 def __lt__(self, x: unicode) -> bool: ...
\r
396 def __le__(self, x: unicode) -> bool: ...
\r
397 def __gt__(self, x: unicode) -> bool: ...
\r
398 def __ge__(self, x: unicode) -> bool: ...
\r
399 def __mod__(self, x: Any) -> str: ...
\r
401 class bytearray(MutableSequence[int]):
\r
403 def __init__(self) -> None: ...
\r
405 def __init__(self, x: Union[Iterable[int], str]) -> None: ...
\r
407 def __init__(self, x: unicode, encoding: unicode,
\r
408 errors: unicode = ...) -> None: ...
\r
410 def __init__(self, length: int) -> None: ...
\r
411 def capitalize(self) -> bytearray: ...
\r
412 def center(self, width: int, fillchar: str = ...) -> bytearray: ...
\r
413 def count(self, x: str) -> int: ...
\r
414 def decode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ...
\r
415 def endswith(self, suffix: Union[str, Tuple[str, ...]]) -> bool: ...
\r
416 def expandtabs(self, tabsize: int = ...) -> bytearray: ...
\r
417 def find(self, sub: str, start: int = ..., end: int = ...) -> int: ...
\r
418 def index(self, sub: str, start: int = ..., end: int = ...) -> int: ...
\r
419 def insert(self, index: int, object: int) -> None: ...
\r
420 def isalnum(self) -> bool: ...
\r
421 def isalpha(self) -> bool: ...
\r
422 def isdigit(self) -> bool: ...
\r
423 def islower(self) -> bool: ...
\r
424 def isspace(self) -> bool: ...
\r
425 def istitle(self) -> bool: ...
\r
426 def isupper(self) -> bool: ...
\r
427 def join(self, iterable: Iterable[str]) -> bytearray: ...
\r
428 def ljust(self, width: int, fillchar: str = ...) -> bytearray: ...
\r
429 def lower(self) -> bytearray: ...
\r
430 def lstrip(self, chars: str = ...) -> bytearray: ...
\r
431 def partition(self, sep: str) -> Tuple[bytearray, bytearray, bytearray]: ...
\r
432 def replace(self, old: str, new: str, count: int = ...) -> bytearray: ...
\r
433 def rfind(self, sub: str, start: int = ..., end: int = ...) -> int: ...
\r
434 def rindex(self, sub: str, start: int = ..., end: int = ...) -> int: ...
\r
435 def rjust(self, width: int, fillchar: str = ...) -> bytearray: ...
\r
436 def rpartition(self, sep: str) -> Tuple[bytearray, bytearray, bytearray]: ...
\r
437 def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[bytearray]: ...
\r
438 def rstrip(self, chars: str = ...) -> bytearray: ...
\r
439 def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[bytearray]: ...
\r
440 def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
\r
441 def startswith(self, prefix: Union[str, Tuple[str, ...]]) -> bool: ...
\r
442 def strip(self, chars: str = ...) -> bytearray: ...
\r
443 def swapcase(self) -> bytearray: ...
\r
444 def title(self) -> bytearray: ...
\r
445 def translate(self, table: str) -> bytearray: ...
\r
446 def upper(self) -> bytearray: ...
\r
447 def zfill(self, width: int) -> bytearray: ...
\r
449 def fromhex(x: str) -> bytearray: ...
\r
451 def __len__(self) -> int: ...
\r
452 def __iter__(self) -> Iterator[int]: ...
\r
453 def __str__(self) -> str: ...
\r
454 def __repr__(self) -> str: ...
\r
455 def __int__(self) -> int: ...
\r
456 def __float__(self) -> float: ...
\r
457 def __hash__(self) -> int: ...
\r
459 def __getitem__(self, i: int) -> int: ...
\r
461 def __getitem__(self, s: slice) -> bytearray: ...
\r
462 def __getslice__(self, start: int, stop: int) -> bytearray: ...
\r
464 def __setitem__(self, i: int, x: int) -> None: ...
\r
466 def __setitem__(self, s: slice, x: Union[Iterable[int], str]) -> None: ...
\r
467 def __setslice__(self, start: int, stop: int, x: Union[Sequence[int], str]) -> None: ...
\r
468 def __delitem__(self, i: Union[int, slice]) -> None: ...
\r
469 def __delslice__(self, start: int, stop: int) -> None: ...
\r
470 def __add__(self, s: str) -> bytearray: ...
\r
471 def __mul__(self, n: int) -> bytearray: ...
\r
472 def __contains__(self, o: object) -> bool: ...
\r
473 def __eq__(self, x: object) -> bool: ...
\r
474 def __ne__(self, x: object) -> bool: ...
\r
475 def __lt__(self, x: str) -> bool: ...
\r
476 def __le__(self, x: str) -> bool: ...
\r
477 def __gt__(self, x: str) -> bool: ...
\r
478 def __ge__(self, x: str) -> bool: ...
\r
481 def __init__(self, o: object = ...) -> None: ...
\r
482 @overload # type: ignore
\r
483 def __and__(self, x: bool) -> bool: ...
\r
484 @overload # type: ignore
\r
485 def __and__(self, x: int) -> int: ...
\r
486 @overload # type: ignore
\r
487 def __or__(self, x: bool) -> bool: ...
\r
488 @overload # type: ignore
\r
489 def __or__(self, x: int) -> int: ...
\r
490 @overload # type: ignore
\r
491 def __xor__(self, x: bool) -> bool: ...
\r
492 @overload # type: ignore
\r
493 def __xor__(self, x: int) -> int: ...
\r
494 @overload # type: ignore
\r
495 def __rand__(self, x: bool) -> bool: ...
\r
496 @overload # type: ignore
\r
497 def __rand__(self, x: int) -> int: ...
\r
498 @overload # type: ignore
\r
499 def __ror__(self, x: bool) -> bool: ...
\r
500 @overload # type: ignore
\r
501 def __ror__(self, x: int) -> int: ...
\r
502 @overload # type: ignore
\r
503 def __rxor__(self, x: bool) -> bool: ...
\r
504 @overload # type: ignore
\r
505 def __rxor__(self, x: int) -> int: ...
\r
507 class slice(object):
\r
508 start = ... # type: Optional[int]
\r
509 step = ... # type: Optional[int]
\r
510 stop = ... # type: Optional[int]
\r
512 def __init__(self, stop: Optional[int]) -> None: ...
\r
514 def __init__(self, start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> None: ...
\r
515 def indices(self, len: int) -> Tuple[int, int, int]: ...
\r
517 class tuple(Sequence[_T_co], Generic[_T_co]):
\r
518 def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ...
\r
519 def __len__(self) -> int: ...
\r
520 def __contains__(self, x: object) -> bool: ...
\r
522 def __getitem__(self, x: int) -> _T_co: ...
\r
524 def __getitem__(self, x: slice) -> Tuple[_T_co, ...]: ...
\r
525 def __iter__(self) -> Iterator[_T_co]: ...
\r
526 def __lt__(self, x: Tuple[_T_co, ...]) -> bool: ...
\r
527 def __le__(self, x: Tuple[_T_co, ...]) -> bool: ...
\r
528 def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ...
\r
529 def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ...
\r
530 def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
\r
531 def __mul__(self, n: int) -> Tuple[_T_co, ...]: ...
\r
532 def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ...
\r
533 def count(self, x: Any) -> int: ...
\r
534 def index(self, x: Any) -> int: ...
\r
537 # TODO name of the class (corresponds to Python 'function' class)
\r
538 __name__ = ... # type: str
\r
539 __module__ = ... # type: str
\r
541 class list(MutableSequence[_T], Generic[_T]):
\r
543 def __init__(self) -> None: ...
\r
545 def __init__(self, iterable: Iterable[_T]) -> None: ...
\r
546 def append(self, object: _T) -> None: ...
\r
547 def extend(self, iterable: Iterable[_T]) -> None: ...
\r
548 def pop(self, index: int = ...) -> _T: ...
\r
549 def index(self, object: _T, start: int = ..., stop: int = ...) -> int: ...
\r
550 def count(self, object: _T) -> int: ...
\r
551 def insert(self, index: int, object: _T) -> None: ...
\r
552 def remove(self, object: _T) -> None: ...
\r
553 def reverse(self) -> None: ...
\r
554 def sort(self, cmp: Callable[[_T, _T], Any] = ..., key: Callable[[_T], Any] = ..., reverse: bool = ...) -> None: ...
\r
556 def __len__(self) -> int: ...
\r
557 def __iter__(self) -> Iterator[_T]: ...
\r
558 def __str__(self) -> str: ...
\r
559 def __hash__(self) -> int: ...
\r
561 def __getitem__(self, i: int) -> _T: ...
\r
563 def __getitem__(self, s: slice) -> List[_T]: ...
\r
564 def __getslice__(self, start: int, stop: int) -> List[_T]: ...
\r
566 def __setitem__(self, i: int, o: _T) -> None: ...
\r
568 def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
\r
569 def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ...
\r
570 def __delitem__(self, i: Union[int, slice]) -> None: ...
\r
571 def __delslice__(self, start: int, stop: int) -> None: ...
\r
572 def __add__(self, x: List[_T]) -> List[_T]: ...
\r
573 def __iadd__(self, x: Iterable[_T]) -> List[_T]: ...
\r
574 def __mul__(self, n: int) -> List[_T]: ...
\r
575 def __rmul__(self, n: int) -> List[_T]: ...
\r
576 def __contains__(self, o: object) -> bool: ...
\r
577 def __reversed__(self) -> Iterator[_T]: ...
\r
578 def __gt__(self, x: List[_T]) -> bool: ...
\r
579 def __ge__(self, x: List[_T]) -> bool: ...
\r
580 def __lt__(self, x: List[_T]) -> bool: ...
\r
581 def __le__(self, x: List[_T]) -> bool: ...
\r
583 class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
\r
584 # NOTE: Keyword arguments are special. If they are used, _KT must include
\r
585 # str, but we have no way of enforcing it here.
\r
587 def __init__(self, **kwargs: _VT) -> None: ...
\r
589 def __init__(self, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
\r
591 def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
\r
593 def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ...
\r
595 def has_key(self, k: _KT) -> bool: ...
\r
596 def clear(self) -> None: ...
\r
597 def copy(self) -> Dict[_KT, _VT]: ...
\r
598 def popitem(self) -> Tuple[_KT, _VT]: ...
\r
599 def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
\r
601 def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
\r
603 def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
\r
605 def update(self, **kwargs: _VT) -> None: ...
\r
606 def iterkeys(self) -> Iterator[_KT]: ...
\r
607 def itervalues(self) -> Iterator[_VT]: ...
\r
608 def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
\r
609 def viewkeys(self) -> KeysView[_KT]: ...
\r
610 def viewvalues(self) -> ValuesView[_VT]: ...
\r
611 def viewitems(self) -> ItemsView[_KT, _VT]: ...
\r
614 def fromkeys(seq: Sequence[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method (mypy/issues#328)
\r
617 def fromkeys(seq: Sequence[_T], value: _S) -> Dict[_T, _S]: ...
\r
618 def __len__(self) -> int: ...
\r
619 def __getitem__(self, k: _KT) -> _VT: ...
\r
620 def __setitem__(self, k: _KT, v: _VT) -> None: ...
\r
621 def __delitem__(self, v: _KT) -> None: ...
\r
622 def __iter__(self) -> Iterator[_KT]: ...
\r
623 def __str__(self) -> str: ...
\r
625 class set(MutableSet[_T], Generic[_T]):
\r
626 def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
\r
627 def add(self, element: _T) -> None: ...
\r
628 def clear(self) -> None: ...
\r
629 def copy(self) -> Set[_T]: ...
\r
630 def difference(self, *s: Iterable[Any]) -> Set[_T]: ...
\r
631 def difference_update(self, *s: Iterable[Any]) -> None: ...
\r
632 def discard(self, element: _T) -> None: ...
\r
633 def intersection(self, *s: Iterable[Any]) -> Set[_T]: ...
\r
634 def intersection_update(self, *s: Iterable[Any]) -> None: ...
\r
635 def isdisjoint(self, s: Iterable[object]) -> bool: ...
\r
636 def issubset(self, s: Iterable[object]) -> bool: ...
\r
637 def issuperset(self, s: Iterable[object]) -> bool: ...
\r
638 def pop(self) -> _T: ...
\r
639 def remove(self, element: _T) -> None: ...
\r
640 def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ...
\r
641 def symmetric_difference_update(self, s: Iterable[_T]) -> None: ...
\r
642 def union(self, *s: Iterable[_T]) -> Set[_T]: ...
\r
643 def update(self, *s: Iterable[_T]) -> None: ...
\r
644 def __len__(self) -> int: ...
\r
645 def __contains__(self, o: object) -> bool: ...
\r
646 def __iter__(self) -> Iterator[_T]: ...
\r
647 def __str__(self) -> str: ...
\r
648 def __and__(self, s: AbstractSet[object]) -> Set[_T]: ...
\r
649 def __iand__(self, s: AbstractSet[object]) -> Set[_T]: ...
\r
650 def __or__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
\r
651 def __ior__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
\r
652 def __sub__(self, s: AbstractSet[object]) -> Set[_T]: ...
\r
653 def __isub__(self, s: AbstractSet[object]) -> Set[_T]: ...
\r
654 def __xor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
\r
655 def __ixor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
\r
656 def __le__(self, s: AbstractSet[object]) -> bool: ...
\r
657 def __lt__(self, s: AbstractSet[object]) -> bool: ...
\r
658 def __ge__(self, s: AbstractSet[object]) -> bool: ...
\r
659 def __gt__(self, s: AbstractSet[object]) -> bool: ...
\r
661 class frozenset(AbstractSet[_T], Generic[_T]):
\r
663 def __init__(self) -> None: ...
\r
665 def __init__(self, iterable: Iterable[_T]) -> None: ...
\r
666 def copy(self) -> FrozenSet[_T]: ...
\r
667 def difference(self, *s: Iterable[object]) -> FrozenSet[_T]: ...
\r
668 def intersection(self, *s: Iterable[object]) -> FrozenSet[_T]: ...
\r
669 def isdisjoint(self, s: Iterable[_T]) -> bool: ...
\r
670 def issubset(self, s: Iterable[object]) -> bool: ...
\r
671 def issuperset(self, s: Iterable[object]) -> bool: ...
\r
672 def symmetric_difference(self, s: Iterable[_T]) -> FrozenSet[_T]: ...
\r
673 def union(self, *s: Iterable[_T]) -> FrozenSet[_T]: ...
\r
674 def __len__(self) -> int: ...
\r
675 def __contains__(self, o: object) -> bool: ...
\r
676 def __iter__(self) -> Iterator[_T]: ...
\r
677 def __str__(self) -> str: ...
\r
678 def __and__(self, s: AbstractSet[_T]) -> FrozenSet[_T]: ...
\r
679 def __or__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T, _S]]: ...
\r
680 def __sub__(self, s: AbstractSet[_T]) -> FrozenSet[_T]: ...
\r
681 def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T, _S]]: ...
\r
682 def __le__(self, s: AbstractSet[object]) -> bool: ...
\r
683 def __lt__(self, s: AbstractSet[object]) -> bool: ...
\r
684 def __ge__(self, s: AbstractSet[object]) -> bool: ...
\r
685 def __gt__(self, s: AbstractSet[object]) -> bool: ...
\r
687 class enumerate(Iterator[Tuple[int, _T]], Generic[_T]):
\r
688 def __init__(self, iterable: Iterable[_T], start: int = ...) -> None: ...
\r
689 def __iter__(self) -> Iterator[Tuple[int, _T]]: ...
\r
690 def next(self) -> Tuple[int, _T]: ...
\r
691 # TODO __getattribute__
\r
693 class xrange(Sized, Iterable[int], Reversible[int]):
\r
695 def __init__(self, stop: int) -> None: ...
\r
697 def __init__(self, start: int, stop: int, step: int = ...) -> None: ...
\r
698 def __len__(self) -> int: ...
\r
699 def __iter__(self) -> Iterator[int]: ...
\r
700 def __getitem__(self, i: int) -> int: ...
\r
701 def __reversed__(self) -> Iterator[int]: ...
\r
703 class property(object):
\r
704 def __init__(self, fget: Optional[Callable[[Any], Any]] = ...,
\r
705 fset: Optional[Callable[[Any, Any], None]] = ...,
\r
706 fdel: Optional[Callable[[Any], None]] = ..., doc: Optional[str] = ...) -> None: ...
\r
707 def getter(self, fget: Callable[[Any], Any]) -> property: ...
\r
708 def setter(self, fset: Callable[[Any, Any], None]) -> property: ...
\r
709 def deleter(self, fdel: Callable[[Any], None]) -> property: ...
\r
710 def __get__(self, obj: Any, type: Optional[type] = ...) -> Any: ...
\r
711 def __set__(self, obj: Any, value: Any) -> None: ...
\r
712 def __delete__(self, obj: Any) -> None: ...
\r
713 def fget(self) -> Any: ...
\r
714 def fset(self, value: Any) -> None: ...
\r
715 def fdel(self) -> None: ...
\r
720 NotImplemented = ... # type: Any
\r
722 def abs(n: SupportsAbs[_T]) -> _T: ...
\r
723 def all(i: Iterable[object]) -> bool: ...
\r
724 def any(i: Iterable[object]) -> bool: ...
\r
725 def bin(number: int) -> str: ...
\r
726 def callable(o: object) -> bool: ...
\r
727 def chr(code: int) -> str: ...
\r
728 def compile(source: Any, filename: unicode, mode: str, flags: int = ...,
\r
729 dont_inherit: int = ...) -> Any: ...
\r
730 def delattr(o: Any, name: unicode) -> None: ...
\r
731 def dir(o: object = ...) -> List[str]: ...
\r
733 def divmod(a: int, b: int) -> Tuple[int, int]: ...
\r
735 def divmod(a: float, b: float) -> Tuple[float, float]: ...
\r
736 def exit(code: Any = ...) -> NoReturn: ...
\r
738 def filter(function: None,
\r
739 iterable: Iterable[Optional[_T]]) -> List[_T]: ...
\r
741 def filter(function: Callable[[_T], Any],
\r
742 iterable: Iterable[_T]) -> List[_T]: ...
\r
743 def format(o: object, format_spec: str = ...) -> str: ... # TODO unicode
\r
744 def getattr(o: Any, name: unicode, default: Optional[Any] = ...) -> Any: ...
\r
745 def hasattr(o: Any, name: unicode) -> bool: ...
\r
746 def hash(o: object) -> int: ...
\r
747 def hex(i: int) -> str: ... # TODO __index__
\r
748 def id(o: object) -> int: ...
\r
749 def input(prompt: Any = ...) -> Any: ...
\r
750 def intern(string: str) -> str: ...
\r
752 def iter(iterable: Iterable[_T]) -> Iterator[_T]: ...
\r
754 def iter(function: Callable[[], _T], sentinel: _T) -> Iterator[_T]: ...
\r
755 def isinstance(o: object, t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
\r
756 def issubclass(cls: type, classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
\r
757 def len(o: Sized) -> int: ...
\r
759 def map(func: None, iter1: Iterable[_T1]) -> List[_T1]: ...
\r
761 def map(func: None,
\r
762 iter1: Iterable[_T1],
\r
763 iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ...
\r
765 def map(func: None,
\r
766 iter1: Iterable[_T1],
\r
767 iter2: Iterable[_T2],
\r
768 iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ...
\r
770 def map(func: None,
\r
771 iter1: Iterable[_T1],
\r
772 iter2: Iterable[_T2],
\r
773 iter3: Iterable[_T3],
\r
774 iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2, _T3, _T4]]: ...
\r
776 def map(func: None,
\r
777 iter1: Iterable[_T1],
\r
778 iter2: Iterable[_T2],
\r
779 iter3: Iterable[_T3],
\r
780 iter4: Iterable[_T4],
\r
781 iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
\r
783 def map(func: None,
\r
784 iter1: Iterable[Any],
\r
785 iter2: Iterable[Any],
\r
786 iter3: Iterable[Any],
\r
787 iter4: Iterable[Any],
\r
788 iter5: Iterable[Any],
\r
789 iter6: Iterable[Any],
\r
790 *iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ...
\r
792 def map(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> List[_S]: ...
\r
794 def map(func: Callable[[_T1, _T2], _S],
\r
795 iter1: Iterable[_T1],
\r
796 iter2: Iterable[_T2]) -> List[_S]: ...
\r
798 def map(func: Callable[[_T1, _T2, _T3], _S],
\r
799 iter1: Iterable[_T1],
\r
800 iter2: Iterable[_T2],
\r
801 iter3: Iterable[_T3]) -> List[_S]: ...
\r
803 def map(func: Callable[[_T1, _T2, _T3, _T4], _S],
\r
804 iter1: Iterable[_T1],
\r
805 iter2: Iterable[_T2],
\r
806 iter3: Iterable[_T3],
\r
807 iter4: Iterable[_T4]) -> List[_S]: ...
\r
809 def map(func: Callable[[_T1, _T2, _T3, _T4, _T5], _S],
\r
810 iter1: Iterable[_T1],
\r
811 iter2: Iterable[_T2],
\r
812 iter3: Iterable[_T3],
\r
813 iter4: Iterable[_T4],
\r
814 iter5: Iterable[_T5]) -> List[_S]: ...
\r
816 def map(func: Callable[..., _S],
\r
817 iter1: Iterable[Any],
\r
818 iter2: Iterable[Any],
\r
819 iter3: Iterable[Any],
\r
820 iter4: Iterable[Any],
\r
821 iter5: Iterable[Any],
\r
822 iter6: Iterable[Any],
\r
823 *iterables: Iterable[Any]) -> List[_S]: ...
\r
825 def max(arg1: _T, arg2: _T, *args: _T, key: Callable[[_T], Any] = ...) -> _T: ...
\r
827 def max(iterable: Iterable[_T], key: Callable[[_T], Any] = ...) -> _T: ...
\r
829 def min(arg1: _T, arg2: _T, *args: _T, key: Callable[[_T], Any] = ...) -> _T: ...
\r
831 def min(iterable: Iterable[_T], key: Callable[[_T], Any] = ...) -> _T: ...
\r
833 def next(i: Iterator[_T]) -> _T: ...
\r
835 def next(i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
\r
836 def oct(i: int) -> str: ... # TODO __index__
\r
838 def open(file: str, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
\r
840 def open(file: unicode, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
\r
842 def open(file: int, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
\r
843 def ord(c: unicode) -> int: ...
\r
844 # This is only available after from __future__ import print_function.
\r
845 def print(*values: Any, sep: unicode = ..., end: unicode = ...,
\r
846 file: IO[Any] = ...) -> None: ...
\r
848 def pow(x: int, y: int) -> Any: ... # The return type can be int or float, depending on y.
\r
850 def pow(x: int, y: int, z: int) -> Any: ...
\r
852 def pow(x: float, y: float) -> float: ...
\r
854 def pow(x: float, y: float, z: float) -> float: ...
\r
855 def quit(code: int = ...) -> None: ...
\r
856 def range(x: int, y: int = ..., step: int = ...) -> List[int]: ...
\r
857 def raw_input(prompt: Any = ...) -> str: ...
\r
860 def reduce(function: Callable[[_T, _S], _T], iterable: Iterable[_S], initializer: _T) -> _T: ...
\r
862 def reduce(function: Callable[[_T, _T], _T], iterable: Iterable[_T]) -> _T: ...
\r
864 def reload(module: Any) -> Any: ...
\r
866 def reversed(object: Sequence[_T]) -> Iterator[_T]: ...
\r
868 def reversed(object: Reversible[_T]) -> Iterator[_T]: ...
\r
869 def repr(o: object) -> str: ...
\r
871 def round(number: float) -> float: ...
\r
873 def round(number: float, ndigits: int) -> float: ... # Always return a float if given ndigits.
\r
875 def round(number: SupportsRound[_T]) -> _T: ...
\r
877 def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
\r
878 def setattr(object: Any, name: unicode, value: Any) -> None: ...
\r
879 def sorted(iterable: Iterable[_T], *,
\r
880 cmp: Callable[[_T, _T], int] = ...,
\r
881 key: Callable[[_T], Any] = ...,
\r
882 reverse: bool = ...) -> List[_T]: ...
\r
884 def sum(iterable: Iterable[_T]) -> Union[_T, int]: ...
\r
886 def sum(iterable: Iterable[_T], start: _S) -> Union[_T, _S]: ...
\r
887 def unichr(i: int) -> unicode: ...
\r
888 def vars(object: Any = ...) -> Dict[str, Any]: ...
\r
890 def zip(iter1: Iterable[_T1]) -> List[Tuple[_T1]]: ...
\r
892 def zip(iter1: Iterable[_T1],
\r
893 iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ...
\r
895 def zip(iter1: Iterable[_T1], iter2: Iterable[_T2],
\r
896 iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ...
\r
898 def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
\r
899 iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2,
\r
902 def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
\r
903 iter4: Iterable[_T4], iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2,
\r
904 _T3, _T4, _T5]]: ...
\r
906 def zip(iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any],
\r
907 iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any],
\r
908 *iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ...
\r
909 def __import__(name: unicode,
\r
910 globals: Dict[str, Any] = ...,
\r
911 locals: Dict[str, Any] = ...,
\r
912 fromlist: List[str] = ..., level: int = ...) -> Any: ...
\r
914 def globals() -> Dict[str, Any]: ...
\r
915 def locals() -> Dict[str, Any]: ...
\r
917 # Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
\r
918 # not exposed anywhere under that name, we make it private here.
\r
919 class ellipsis: ...
\r
920 Ellipsis = ... # type: ellipsis
\r
922 # TODO: buffer support is incomplete; e.g. some_string.startswith(some_buffer) doesn't type check.
\r
923 _AnyBuffer = TypeVar('_AnyBuffer', str, unicode, bytearray, buffer)
\r
925 class buffer(Sized):
\r
926 def __init__(self, object: _AnyBuffer, offset: int = ..., size: int = ...) -> None: ...
\r
927 def __add__(self, other: _AnyBuffer) -> str: ...
\r
928 def __cmp__(self, other: _AnyBuffer) -> bool: ...
\r
929 def __getitem__(self, key: Union[int, slice]) -> str: ...
\r
930 def __getslice__(self, i: int, j: int) -> str: ...
\r
931 def __len__(self) -> int: ...
\r
932 def __mul__(self, x: int) -> str: ...
\r
934 class memoryview(Sized, Container[bytes]):
\r
935 format = ... # type: str
\r
936 itemsize = ... # type: int
\r
937 shape = ... # type: Optional[Tuple[int, ...]]
\r
938 strides = ... # type: Optional[Tuple[int, ...]]
\r
939 suboffsets = ... # type: Optional[Tuple[int, ...]]
\r
940 readonly = ... # type: bool
\r
941 ndim = ... # type: int
\r
943 def __init__(self, obj: Union[str, bytearray, buffer, memoryview]) -> None: ...
\r
946 def __getitem__(self, i: int) -> bytes: ...
\r
948 def __getitem__(self, s: slice) -> memoryview: ...
\r
950 def __contains__(self, x: object) -> bool: ...
\r
951 def __iter__(self) -> Iterator[bytes]: ...
\r
952 def __len__(self) -> int: ...
\r
955 def __setitem__(self, i: int, o: bytes) -> None: ...
\r
957 def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ...
\r
959 def __setitem__(self, s: slice, o: memoryview) -> None: ...
\r
961 def tobytes(self) -> bytes: ...
\r
962 def tolist(self) -> List[int]: ...
\r
964 class BaseException(object):
\r
965 args = ... # type: Tuple[Any, ...]
\r
966 message = ... # type: Any
\r
967 def __init__(self, *args: object, **kwargs: object) -> None: ...
\r
968 def __getitem__(self, i: int) -> Any: ...
\r
969 def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ...
\r
971 class GeneratorExit(BaseException): ...
\r
972 class KeyboardInterrupt(BaseException): ...
\r
973 class SystemExit(BaseException):
\r
975 class Exception(BaseException): ...
\r
976 class StopIteration(Exception): ...
\r
977 class StandardError(Exception): ...
\r
978 class ArithmeticError(StandardError): ...
\r
979 class BufferError(StandardError): ...
\r
980 class EnvironmentError(StandardError):
\r
982 strerror = ... # type: str
\r
983 # TODO can this be unicode?
\r
984 filename = ... # type: str
\r
985 class LookupError(StandardError): ...
\r
986 class RuntimeError(StandardError): ...
\r
987 class ValueError(StandardError): ...
\r
988 class AssertionError(StandardError): ...
\r
989 class AttributeError(StandardError): ...
\r
990 class EOFError(StandardError): ...
\r
991 class FloatingPointError(ArithmeticError): ...
\r
992 class IOError(EnvironmentError): ...
\r
993 class ImportError(StandardError): ...
\r
994 class IndexError(LookupError): ...
\r
995 class KeyError(LookupError): ...
\r
996 class MemoryError(StandardError): ...
\r
997 class NameError(StandardError): ...
\r
998 class NotImplementedError(RuntimeError): ...
\r
999 class OSError(EnvironmentError): ...
\r
1000 class WindowsError(OSError):
\r
1001 winerror = ... # type: int
\r
1002 class OverflowError(ArithmeticError): ...
\r
1003 class ReferenceError(StandardError): ...
\r
1004 class SyntaxError(StandardError):
\r
1005 msg = ... # type: str
\r
1006 lineno = ... # type: int
\r
1007 offset = ... # type: int
\r
1008 text = ... # type: str
\r
1009 filename = ... # type: str
\r
1010 class IndentationError(SyntaxError): ...
\r
1011 class TabError(IndentationError): ...
\r
1012 class SystemError(StandardError): ...
\r
1013 class TypeError(StandardError): ...
\r
1014 class UnboundLocalError(NameError): ...
\r
1015 class UnicodeError(ValueError): ...
\r
1016 class UnicodeDecodeError(UnicodeError):
\r
1022 def __init__(self, __encoding: bytes, __object: bytes, __start: int, __end: int,
\r
1023 __reason: bytes) -> None: ...
\r
1024 class UnicodeEncodeError(UnicodeError):
\r
1030 def __init__(self, __encoding: bytes, __object: unicode, __start: int, __end: int,
\r
1031 __reason: bytes) -> None: ...
\r
1032 class UnicodeTranslateError(UnicodeError): ...
\r
1033 class ZeroDivisionError(ArithmeticError): ...
\r
1035 class Warning(Exception): ...
\r
1036 class UserWarning(Warning): ...
\r
1037 class DeprecationWarning(Warning): ...
\r
1038 class SyntaxWarning(Warning): ...
\r
1039 class RuntimeWarning(Warning): ...
\r
1040 class FutureWarning(Warning): ...
\r
1041 class PendingDeprecationWarning(Warning): ...
\r
1042 class ImportWarning(Warning): ...
\r
1043 class UnicodeWarning(Warning): ...
\r
1044 class BytesWarning(Warning): ...
\r
1046 def eval(s: Union[str, unicode], globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> Any: ...
\r
1047 def exec(object: str,
\r
1048 globals: Optional[Dict[str, Any]] = ...,
\r
1049 locals: Optional[Dict[str, Any]] = ...) -> Any: ... # TODO code object as source
\r
1051 def cmp(x: Any, y: Any) -> int: ...
\r
1053 def execfile(filename: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Dict[str, Any]] = ...) -> None: ...
\r
1055 class file(BinaryIO):
\r
1057 def __init__(self, file: str, mode: str = ..., buffering: int = ...) -> None: ...
\r
1059 def __init__(self, file: unicode, mode: str = ..., buffering: int = ...) -> None: ...
\r
1061 def __init__(self, file: int, mode: str = ..., buffering: int = ...) -> None: ...
\r
1062 def __iter__(self) -> Iterator[str]: ...
\r
1063 def next(self) -> str: ...
\r
1064 def read(self, n: int = ...) -> str: ...
\r
1065 def __enter__(self) -> BinaryIO: ...
\r
1066 def __exit__(self, t: Optional[type] = ..., exc: Optional[BaseException] = ..., tb: Optional[Any] = ...) -> bool: ...
\r
1067 def flush(self) -> None: ...
\r
1068 def fileno(self) -> int: ...
\r
1069 def isatty(self) -> bool: ...
\r
1070 def close(self) -> None: ...
\r
1072 def readable(self) -> bool: ...
\r
1073 def writable(self) -> bool: ...
\r
1074 def seekable(self) -> bool: ...
\r
1075 def seek(self, offset: int, whence: int = ...) -> int: ...
\r
1076 def tell(self) -> int: ...
\r
1077 def readline(self, limit: int = ...) -> str: ...
\r
1078 def readlines(self, hint: int = ...) -> List[str]: ...
\r
1079 def write(self, data: str) -> int: ...
\r
1080 def writelines(self, data: Iterable[str]) -> None: ...
\r
1081 def truncate(self, pos: Optional[int] = ...) -> int: ...
\r
1083 # Very old builtins
\r
1084 def apply(func: Callable[..., _T], args: Optional[Sequence[Any]] = ..., kwds: Optional[Mapping[str, Any]] = ...) -> _T: ...
\r
1085 _N = TypeVar('_N', bool, int, float, complex)
\r
1086 def coerce(x: _N, y: _N) -> Tuple[_N, _N]: ...
\r