mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Sync with typeshed @ 3d638b067726d28ef523207f2b3a566bca461843
Apply minor changes in codebase/testdata to reduce number of failing tests.
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
# 17952 E704 multiple statements on one line (def)
|
||||
# 12197 E301 expected 1 blank line
|
||||
# 7155 E302 expected 2 blank lines
|
||||
# 2307 E501 line too long
|
||||
# 1463 F401 imported but unused
|
||||
# 967 E701 multiple statements on one line (colon)
|
||||
# 457 F811 redefinition
|
||||
@@ -11,13 +10,16 @@
|
||||
# 4 E741 ambiguous variable name
|
||||
|
||||
# Nice-to-haves ignored for now
|
||||
# 159 E128 continuation line under-indented for visual indent
|
||||
# 34 E127 continuation line over-indented for visual indent
|
||||
# 2307 E501 line too long
|
||||
|
||||
# Other ignored warnings
|
||||
# W504 line break after binary operator
|
||||
|
||||
[flake8]
|
||||
ignore = F401, F403, F405, F811, E127, E128, E301, E302, E305, E501, E701, E704, E741, B303
|
||||
ignore = F401, F403, F405, F811, E301, E302, E305, E501, E701, E704, E741, B303, W504
|
||||
# We are checking with Python 3 but many of the stubs are Python 2 stubs.
|
||||
# A nice future improvement would be to provide separate .flake8
|
||||
# configurations for Python 2 and Python 3 files.
|
||||
builtins = StandardError,apply,basestring,buffer,cmp,coerce,execfile,file,intern,long,raw_input,reduce,reload,unichr,unicode,xrange
|
||||
exclude = .venv*,@*,.git
|
||||
max-line-length = 130
|
||||
|
||||
@@ -1,24 +1,30 @@
|
||||
sudo: false
|
||||
dist: xenial
|
||||
language: python
|
||||
python: 3.7
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- python: "3.6-dev"
|
||||
env: TEST_CMD="flake8"
|
||||
- python: "3.6"
|
||||
env: TEST_CMD="./tests/pytype_test.py --num-parallel=4"
|
||||
- python: "3.5-dev"
|
||||
- name: "pytype"
|
||||
python: 3.6
|
||||
env:
|
||||
- TEST_CMD="./tests/pytype_test.py --num-parallel=4"
|
||||
- INSTALL="test"
|
||||
- name: "mypy"
|
||||
env:
|
||||
- TEST_CMD="./tests/mypy_test.py"
|
||||
- INSTALL="mypy"
|
||||
- name: "mypy self test"
|
||||
env: TEST_CMD="./tests/mypy_selftest.py"
|
||||
- python: "3.5"
|
||||
env: TEST_CMD="./tests/mypy_test.py"
|
||||
- python: "3.4"
|
||||
- name: "check file consistency"
|
||||
env: TEST_CMD="./tests/check_consistent.py"
|
||||
- name: "flake8"
|
||||
env:
|
||||
- TEST_CMD="flake8"
|
||||
- INSTALL="test"
|
||||
|
||||
install:
|
||||
# pytype needs py-3.6, mypy needs py-3.3+. Additional logic in runtests.py
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == '3.6-dev' ]]; then pip install -r requirements-tests-py3.txt; fi
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then pip install -r requirements-tests-py3.txt; fi
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then pip install -U git+git://github.com/python/mypy git+git://github.com/python/typed_ast; fi
|
||||
- if [[ $INSTALL == 'test' ]]; then pip install -r requirements-tests-py3.txt; fi
|
||||
- if [[ $INSTALL == 'mypy' ]]; then pip install -U git+git://github.com/python/mypy git+git://github.com/python/typed_ast; fi
|
||||
|
||||
script:
|
||||
- $TEST_CMD
|
||||
|
||||
@@ -29,8 +29,8 @@ For more details, read below.
|
||||
## Discussion
|
||||
|
||||
If you've run into behavior in the type checker that suggests the type
|
||||
stubs for a given library are incorrect or incomplete, or a library you
|
||||
depend on is missing type annotations, we want to hear from you!
|
||||
stubs for a given library are incorrect or incomplete,
|
||||
we want to hear from you!
|
||||
|
||||
Our main forum for discussion is the project's [GitHub issue
|
||||
tracker](https://github.com/python/typeshed/issues). This is the right
|
||||
@@ -111,8 +111,9 @@ know and **get their permission**. Do it by opening an issue on their
|
||||
project's bug tracker. This gives them the opportunity to
|
||||
consider adopting type hints directly in their codebase (which you
|
||||
should prefer to external type stubs). When the project owners agree
|
||||
for you to submit stubs here, open a pull request **referencing the
|
||||
message where you received permission**.
|
||||
for you to submit stubs here or you do not receive a reply within
|
||||
one month, open a pull request **referencing the
|
||||
issue where you asked for permission**.
|
||||
|
||||
Make sure your changes pass the tests (the [README](README.md#running-the-tests)
|
||||
has more information).
|
||||
@@ -144,13 +145,46 @@ Example:
|
||||
def list2cmdline(seq: Sequence[str]) -> str: ... # undocumented
|
||||
```
|
||||
|
||||
### Incomplete stubs
|
||||
|
||||
We accept partial stubs, especially for larger packages. These need to
|
||||
follow the following guidelines:
|
||||
|
||||
* Included functions and methods must list all arguments, but the arguments
|
||||
can be left unannotated. Do not use `Any` to mark unannotated arguments
|
||||
or return values.
|
||||
* Partial classes must include a `__getattr__()` method marked with an
|
||||
`# incomplete` comment (see example below).
|
||||
* Partial modules (i.e. modules that are missing some or all classes,
|
||||
functions, or attributes) must include a top-level `__getattr__()`
|
||||
function marked with an `# incomplete` comment (see example below).
|
||||
* Partial packages (i.e. packages that are missing one or more sub-modules)
|
||||
must have a `__init__.pyi` stub that is marked as incomplete (see above).
|
||||
A better alternative is to create empty stubs for all sub-modules and
|
||||
mark them as incomplete individually.
|
||||
|
||||
Example of a partial module with a partial class `Foo` and a partially
|
||||
annotated function `bar()`:
|
||||
|
||||
```python
|
||||
def __getattr__(name: str) -> Any: ... # incomplete
|
||||
|
||||
class Foo:
|
||||
def __getattr__(self, name: str) -> Any: # incomplete
|
||||
x: int
|
||||
y: str
|
||||
|
||||
def bar(x: str, y, *, z=...): ...
|
||||
```
|
||||
|
||||
### Using stubgen
|
||||
|
||||
Mypy includes a tool called [stubgen](https://github.com/python/mypy/blob/master/mypy/stubgen.py)
|
||||
that you can use as a starting point for your stubs. Note that this
|
||||
generator is currently unable to determine most argument and return
|
||||
types and omits them or uses ``Any`` in their place. Fill out the types
|
||||
that you know.
|
||||
Mypy includes a tool called [stubgen](https://mypy.readthedocs.io/en/latest/stubgen.html)
|
||||
that auto-generates stubs for Python and C modules using static analysis,
|
||||
Sphinx docs, and runtime introspection. It can be used to get a starting
|
||||
point for your stubs. Note that this generator is currently unable to
|
||||
determine most argument and return types and omits them or uses ``Any`` in
|
||||
their place. Fill out manually the types that you know.
|
||||
|
||||
### Stub file coding style
|
||||
|
||||
@@ -187,6 +221,8 @@ you should know about.
|
||||
Style conventions for stub files are different from PEP 8. The general
|
||||
rule is that they should be as concise as possible. Specifically:
|
||||
* lines can be up to 130 characters long;
|
||||
* functions and methods that don't fit in one line should be split up
|
||||
with one argument per line;
|
||||
* all function bodies should be empty;
|
||||
* prefer ``...`` over ``pass``;
|
||||
* prefer ``...`` on the same line as the class/function signature;
|
||||
@@ -198,6 +234,8 @@ rule is that they should be as concise as possible. Specifically:
|
||||
* use variable annotations instead of type comments, even for stubs
|
||||
that target older versions of Python;
|
||||
* for arguments with a type and a default, use spaces around the `=`.
|
||||
The code formatter [black](https://github.com/ambv/black) will format
|
||||
stubs according to this standard.
|
||||
|
||||
Stub files should only contain information necessary for the type
|
||||
checker, and leave out unnecessary detail:
|
||||
@@ -223,6 +261,15 @@ unless:
|
||||
* they use the form ``from library import *`` which means all names
|
||||
from that library are exported.
|
||||
|
||||
When adding type hints, avoid using the `Any` type when possible. Reserve
|
||||
the use of `Any` for when:
|
||||
* the correct type cannot be expressed in the current type system; and
|
||||
* to avoid Union returns (see above).
|
||||
|
||||
Note that `Any` is not the correct type to use if you want to indicate
|
||||
that some function can accept literally anything: in those cases use
|
||||
`object` instead.
|
||||
|
||||
For arguments with type and a default value of `None`, PEP 484
|
||||
prescribes that the type automatically becomes `Optional`. However we
|
||||
prefer explicit over implicit in this case, and require the explicit
|
||||
@@ -312,19 +359,9 @@ We aim to reply to all new issues promptly. We'll assign one or more
|
||||
labels to indicate we've triaged an issue, but most typeshed issues
|
||||
are relatively simple (stubs for a given module or package are
|
||||
missing, incomplete or incorrect) and we won't add noise to the
|
||||
tracker by labeling all of them. Here's what our labels mean. (We
|
||||
also apply these to pull requests.)
|
||||
|
||||
* **bug**: It's a bug in a stub.
|
||||
* **bytes-unicode**: It's related to bytes vs. unicode, usually Python 2.
|
||||
* **feature**: It's a new typeshed feature.
|
||||
* **priority-high**: This issue is more important than most.
|
||||
* **priority-low**: This issue is less important than most.
|
||||
* **priority-normal**: This issue has average priority.
|
||||
* **question**: Not really an issue, but a question on how to do something.
|
||||
* **size-large**: An issue of high complexity or affecting many files.
|
||||
* **size-medium**: An issue of average complexity.
|
||||
* **size-small**: An issue that will take only little effort to fix.
|
||||
tracker by labeling all of them. Please see the
|
||||
[list of all labels](https://github.com/python/typeshed/issues/labels)
|
||||
for a detailed description of the labels we use.
|
||||
|
||||
Sometimes a PR can't make progress until some external issue is
|
||||
addressed. We indicate this by editing the subject to add a ``[WIP]``
|
||||
|
||||
@@ -135,10 +135,10 @@ For mypy, if you are in the typeshed repo that is submodule of the
|
||||
mypy repo (so `..` refers to the mypy repo), there's a shortcut to run
|
||||
the mypy tests that avoids installing mypy:
|
||||
```bash
|
||||
$ PYTHONPATH=.. python3 tests/mypy_test.py
|
||||
$ PYTHONPATH=../.. python3 tests/mypy_test.py
|
||||
```
|
||||
You can mypy tests to a single version by passing `-p2` or `-p3.5` e.g.
|
||||
```bash
|
||||
$ PYTHONPATH=.. python3 tests/mypy_test.py -p3.5
|
||||
$ PYTHONPATH=../.. python3 tests/mypy_test.py -p3.5
|
||||
running mypy --python-version 3.5 --strict-optional # with 342 files
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
git+https://github.com/python/mypy.git@master
|
||||
typed-ast>=1.0.4
|
||||
flake8==3.5.0
|
||||
flake8-bugbear==18.2.0
|
||||
flake8-pyi>=18.3.1
|
||||
pytype>=2018.9.19
|
||||
flake8==3.6.0
|
||||
flake8-bugbear==18.8.0
|
||||
flake8-pyi==18.3.1
|
||||
pytype>=2019.2.13
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
# NB: __builtin__.pyi and builtins.pyi must remain consistent!
|
||||
# Stubs for builtins (Python 2.7)
|
||||
|
||||
# True and False are deliberately omitted because they are keywords in
|
||||
# Python 3, and stub files conform to Python 3 syntax.
|
||||
|
||||
from typing import (
|
||||
TypeVar, Iterator, Iterable, NoReturn, overload,
|
||||
Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set,
|
||||
AbstractSet, FrozenSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
|
||||
SupportsComplex, SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping,
|
||||
MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, Type
|
||||
TypeVar, Iterator, Iterable, NoReturn, overload, Container,
|
||||
Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic,
|
||||
Set, AbstractSet, FrozenSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
|
||||
SupportsComplex, SupportsRound, IO, BinaryIO, Union,
|
||||
ItemsView, KeysView, ValuesView, ByteString, Optional, AnyStr, Type, Text,
|
||||
)
|
||||
from abc import abstractmethod, ABCMeta
|
||||
from ast import mod
|
||||
from types import TracebackType, CodeType
|
||||
import sys
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T_co = TypeVar('_T_co', covariant=True)
|
||||
@@ -26,12 +26,15 @@ _T5 = TypeVar('_T5')
|
||||
_TT = TypeVar('_TT', bound='type')
|
||||
|
||||
class object:
|
||||
__doc__ = ... # type: Optional[str]
|
||||
__class__ = ... # type: type
|
||||
__dict__ = ... # type: Dict[str, Any]
|
||||
__slots__ = ... # type: Union[str, unicode, Iterable[Union[str, unicode]]]
|
||||
__module__ = ... # type: str
|
||||
__doc__: Optional[str]
|
||||
__dict__: Dict[str, Any]
|
||||
__slots__: Union[Text, Iterable[Text]]
|
||||
__module__: str
|
||||
|
||||
@property
|
||||
def __class__(self: _T) -> Type[_T]: ...
|
||||
@__class__.setter
|
||||
def __class__(self, __type: Type[object]) -> None: ...
|
||||
def __init__(self) -> None: ...
|
||||
def __new__(cls) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||
@@ -48,49 +51,69 @@ class object:
|
||||
def __reduce_ex__(self, protocol: int) -> tuple: ...
|
||||
|
||||
class staticmethod(object): # Special, only valid as a decorator.
|
||||
__func__ = ... # type: function
|
||||
__func__: Callable
|
||||
|
||||
def __init__(self, f: function) -> None: ...
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
|
||||
class classmethod(object): # Special, only valid as a decorator.
|
||||
__func__ = ... # type: function
|
||||
__func__: Callable
|
||||
|
||||
def __init__(self, f: function) -> None: ...
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
|
||||
class type(object):
|
||||
__bases__ = ... # type: Tuple[type, ...]
|
||||
__name__ = ... # type: str
|
||||
__module__ = ... # type: str
|
||||
__base__: type
|
||||
__bases__: Tuple[type, ...]
|
||||
__basicsize__: int
|
||||
__dict__: Dict[str, Any]
|
||||
__dictoffset__: int
|
||||
__flags__: int
|
||||
__itemsize__: int
|
||||
__module__: str
|
||||
__mro__: Tuple[type, ...]
|
||||
__name__: str
|
||||
__weakrefoffset__: int
|
||||
|
||||
@overload
|
||||
def __init__(self, o: object) -> None: ...
|
||||
@overload
|
||||
def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any]) -> None: ...
|
||||
# TODO: __new__ may have to be special and not a static method.
|
||||
@overload
|
||||
def __new__(cls, o: object) -> type: ...
|
||||
@overload
|
||||
def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ...
|
||||
def __call__(self, *args: Any, **kwds: Any) -> Any: ...
|
||||
|
||||
# Only new-style classes
|
||||
__mro__ = ... # type: Tuple[type, ...]
|
||||
def __subclasses__(self: _TT) -> List[_TT]: ...
|
||||
# Note: the documentation doesnt specify what the return type is, the standard
|
||||
# implementation seems to be returning a list.
|
||||
def mro(self) -> List[type]: ...
|
||||
def __subclasses__(self: _TT) -> List[_TT]: ...
|
||||
def __instancecheck__(self, instance: Any) -> bool: ...
|
||||
def __subclasscheck__(self, subclass: type) -> bool: ...
|
||||
|
||||
class super(object):
|
||||
@overload
|
||||
def __init__(self, t: Any, obj: Any) -> None: ...
|
||||
@overload
|
||||
def __init__(self, t: Any) -> None: ...
|
||||
|
||||
class int:
|
||||
@overload
|
||||
def __init__(self, x: SupportsInt = ...) -> None: ...
|
||||
def __init__(self, x: Union[Text, bytes, SupportsInt] = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: Union[str, unicode, bytearray], base: int = ...) -> None: ...
|
||||
def __init__(self, x: Union[Text, bytes, bytearray], base: int) -> None: ...
|
||||
|
||||
@property
|
||||
def real(self) -> int: ...
|
||||
@property
|
||||
def imag(self) -> int: ...
|
||||
@property
|
||||
def numerator(self) -> int: ...
|
||||
@property
|
||||
def denominator(self) -> int: ...
|
||||
def conjugate(self) -> int: ...
|
||||
|
||||
def bit_length(self) -> int: ...
|
||||
|
||||
@@ -125,6 +148,7 @@ class int:
|
||||
def __neg__(self) -> int: ...
|
||||
def __pos__(self) -> int: ...
|
||||
def __invert__(self) -> int: ...
|
||||
def __getnewargs__(self) -> Tuple[int]: ...
|
||||
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
@@ -142,13 +166,19 @@ class int:
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
class float:
|
||||
def __init__(self, x: Union[SupportsFloat, str, unicode, bytearray] = ...) -> None: ...
|
||||
def __init__(self, x: Union[SupportsFloat, Text, bytes, bytearray] = ...) -> 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: ...
|
||||
|
||||
@property
|
||||
def real(self) -> float: ...
|
||||
@property
|
||||
def imag(self) -> float: ...
|
||||
def conjugate(self) -> float: ...
|
||||
|
||||
def __add__(self, x: float) -> float: ...
|
||||
def __sub__(self, x: float) -> float: ...
|
||||
def __mul__(self, x: float) -> float: ...
|
||||
@@ -157,7 +187,7 @@ class float:
|
||||
def __truediv__(self, x: float) -> float: ...
|
||||
def __mod__(self, x: float) -> float: ...
|
||||
def __divmod__(self, x: float) -> Tuple[float, float]: ...
|
||||
def __pow__(self, x: float) -> float: ...
|
||||
def __pow__(self, x: float) -> float: ... # In Python 3, returns complex if self is negative and x is not whole
|
||||
def __radd__(self, x: float) -> float: ...
|
||||
def __rsub__(self, x: float) -> float: ...
|
||||
def __rmul__(self, x: float) -> float: ...
|
||||
@@ -167,6 +197,7 @@ class float:
|
||||
def __rmod__(self, x: float) -> float: ...
|
||||
def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
|
||||
def __rpow__(self, x: float) -> float: ...
|
||||
def __getnewargs__(self) -> Tuple[float]: ...
|
||||
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
@@ -217,18 +248,12 @@ class complex:
|
||||
def __neg__(self) -> complex: ...
|
||||
def __pos__(self) -> complex: ...
|
||||
|
||||
def __complex__(self) -> complex: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __complex__(self) -> complex: ...
|
||||
def __abs__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __nonzero__(self) -> bool: ...
|
||||
|
||||
class super(object):
|
||||
@overload
|
||||
def __init__(self, t: Any, obj: Any) -> None: ...
|
||||
@overload
|
||||
def __init__(self, t: Any) -> None: ...
|
||||
|
||||
class basestring(metaclass=ABCMeta): ...
|
||||
|
||||
class unicode(basestring, Sequence[unicode]):
|
||||
@@ -308,19 +333,22 @@ class unicode(basestring, Sequence[unicode]):
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __getnewargs__(self) -> Tuple[unicode]: ...
|
||||
|
||||
class str(basestring, Sequence[str]):
|
||||
def __init__(self, object: object = ...) -> None: ...
|
||||
_str_base = basestring
|
||||
|
||||
class str(Sequence[str], _str_base):
|
||||
def __init__(self, o: object = ...) -> None: ...
|
||||
def capitalize(self) -> str: ...
|
||||
def center(self, width: int, fillchar: str = ...) -> str: ...
|
||||
def count(self, x: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ...
|
||||
def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ...
|
||||
def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]]) -> bool: ...
|
||||
def count(self, x: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ...
|
||||
def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ...
|
||||
def endswith(self, suffix: Union[Text, Tuple[Text, ...]]) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> str: ...
|
||||
def find(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def format(self, *args: Any, **kwargs: Any) -> str: ...
|
||||
def index(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
def isalpha(self) -> bool: ...
|
||||
def isdigit(self) -> bool: ...
|
||||
@@ -342,8 +370,8 @@ class str(basestring, Sequence[str]):
|
||||
@overload
|
||||
def partition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
|
||||
def replace(self, old: AnyStr, new: AnyStr, count: int = ...) -> AnyStr: ...
|
||||
def rfind(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rindex(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rfind(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rindex(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rjust(self, width: int, fillchar: str = ...) -> str: ...
|
||||
@overload
|
||||
def rpartition(self, sep: bytearray) -> Tuple[str, bytearray, str]: ...
|
||||
@@ -364,7 +392,7 @@ class str(basestring, Sequence[str]):
|
||||
@overload
|
||||
def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[str]: ...
|
||||
def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]]) -> bool: ...
|
||||
def startswith(self, prefix: Union[Text, Tuple[Text, ...]]) -> bool: ...
|
||||
@overload
|
||||
def strip(self, chars: str = ...) -> str: ...
|
||||
@overload
|
||||
@@ -375,45 +403,48 @@ class str(basestring, Sequence[str]):
|
||||
def upper(self) -> str: ...
|
||||
def zfill(self, width: int) -> str: ...
|
||||
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
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) -> str: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> str: ...
|
||||
def __getslice__(self, start: int, stop: int) -> str: ...
|
||||
def __add__(self, s: AnyStr) -> AnyStr: ...
|
||||
def __mul__(self, n: int) -> str: ...
|
||||
def __rmul__(self, n: int) -> str: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __lt__(self, x: unicode) -> bool: ...
|
||||
def __le__(self, x: unicode) -> bool: ...
|
||||
def __gt__(self, x: unicode) -> bool: ...
|
||||
def __ge__(self, x: unicode) -> bool: ...
|
||||
def __ge__(self, x: Text) -> bool: ...
|
||||
def __getitem__(self, i: Union[int, slice]) -> str: ...
|
||||
def __gt__(self, x: Text) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __le__(self, x: Text) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __lt__(self, x: Text) -> bool: ...
|
||||
def __mod__(self, x: Any) -> str: ...
|
||||
def __mul__(self, n: int) -> str: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __rmul__(self, n: int) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __getnewargs__(self) -> Tuple[str]: ...
|
||||
|
||||
class bytearray(MutableSequence[int]):
|
||||
def __getslice__(self, start: int, stop: int) -> str: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __int__(self) -> int: ...
|
||||
|
||||
|
||||
bytes = str
|
||||
|
||||
class bytearray(MutableSequence[int], ByteString):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: Union[Iterable[int], str]) -> None: ...
|
||||
def __init__(self, ints: Iterable[int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: unicode, encoding: unicode,
|
||||
errors: unicode = ...) -> None: ...
|
||||
def __init__(self, string: str) -> None: ...
|
||||
@overload
|
||||
def __init__(self, string: Text, encoding: Text, errors: Text = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, length: int) -> None: ...
|
||||
def capitalize(self) -> bytearray: ...
|
||||
def center(self, width: int, fillchar: str = ...) -> bytearray: ...
|
||||
def center(self, width: int, fillchar: bytes = ...) -> bytearray: ...
|
||||
def count(self, x: str) -> int: ...
|
||||
def decode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ...
|
||||
def endswith(self, suffix: Union[str, Tuple[str, ...]]) -> bool: ...
|
||||
def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ...
|
||||
def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> bytearray: ...
|
||||
def find(self, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
def index(self, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
@@ -428,26 +459,31 @@ class bytearray(MutableSequence[int]):
|
||||
def join(self, iterable: Iterable[str]) -> bytearray: ...
|
||||
def ljust(self, width: int, fillchar: str = ...) -> bytearray: ...
|
||||
def lower(self) -> bytearray: ...
|
||||
def lstrip(self, chars: str = ...) -> bytearray: ...
|
||||
def partition(self, sep: str) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def replace(self, old: str, new: str, count: int = ...) -> bytearray: ...
|
||||
def rfind(self, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
def rindex(self, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
def rjust(self, width: int, fillchar: str = ...) -> bytearray: ...
|
||||
def rpartition(self, sep: str) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def rstrip(self, chars: str = ...) -> bytearray: ...
|
||||
def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def lstrip(self, chars: Optional[bytes] = ...) -> bytearray: ...
|
||||
def partition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def replace(self, old: bytes, new: bytes, count: int = ...) -> bytearray: ...
|
||||
def rfind(self, sub: bytes, start: int = ..., end: int = ...) -> int: ...
|
||||
def rindex(self, sub: bytes, start: int = ..., end: int = ...) -> int: ...
|
||||
def rjust(self, width: int, fillchar: bytes = ...) -> bytearray: ...
|
||||
def rpartition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def rsplit(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def rstrip(self, chars: Optional[bytes] = ...) -> bytearray: ...
|
||||
def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
|
||||
def startswith(self, prefix: Union[str, Tuple[str, ...]]) -> bool: ...
|
||||
def strip(self, chars: str = ...) -> bytearray: ...
|
||||
def startswith(
|
||||
self,
|
||||
prefix: Union[bytes, Tuple[bytes, ...]],
|
||||
start: Optional[int] = ...,
|
||||
end: Optional[int] = ...,
|
||||
) -> bool: ...
|
||||
def strip(self, chars: Optional[bytes] = ...) -> bytearray: ...
|
||||
def swapcase(self) -> bytearray: ...
|
||||
def title(self) -> bytearray: ...
|
||||
def translate(self, table: str) -> bytearray: ...
|
||||
def upper(self) -> bytearray: ...
|
||||
def zfill(self, width: int) -> bytearray: ...
|
||||
@staticmethod
|
||||
def fromhex(x: str) -> bytearray: ...
|
||||
def fromhex(s: str) -> bytearray: ...
|
||||
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[int]: ...
|
||||
@@ -460,55 +496,89 @@ class bytearray(MutableSequence[int]):
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> bytearray: ...
|
||||
def __getslice__(self, start: int, stop: int) -> bytearray: ...
|
||||
@overload
|
||||
def __setitem__(self, i: int, x: int) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, x: Union[Iterable[int], str]) -> None: ...
|
||||
def __setslice__(self, start: int, stop: int, x: Union[Sequence[int], str]) -> None: ...
|
||||
def __setitem__(self, s: slice, x: Union[Iterable[int], bytes]) -> None: ...
|
||||
def __delitem__(self, i: Union[int, slice]) -> None: ...
|
||||
def __getslice__(self, start: int, stop: int) -> bytearray: ...
|
||||
def __setslice__(self, start: int, stop: int, x: Union[Sequence[int], str]) -> None: ...
|
||||
def __delslice__(self, start: int, stop: int) -> None: ...
|
||||
def __add__(self, s: str) -> bytearray: ...
|
||||
def __add__(self, s: bytes) -> bytearray: ...
|
||||
def __mul__(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: str) -> bool: ...
|
||||
def __le__(self, x: str) -> bool: ...
|
||||
def __gt__(self, x: str) -> bool: ...
|
||||
def __ge__(self, x: str) -> 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: ...
|
||||
|
||||
_mv_container_type = str
|
||||
|
||||
class memoryview(Sized, Container[_mv_container_type]):
|
||||
format: str
|
||||
itemsize: int
|
||||
shape: Optional[Tuple[int, ...]]
|
||||
strides: Optional[Tuple[int, ...]]
|
||||
suboffsets: Optional[Tuple[int, ...]]
|
||||
readonly: bool
|
||||
ndim: int
|
||||
|
||||
def __init__(self, obj: Union[bytes, bytearray, buffer, memoryview]) -> None: ...
|
||||
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> _mv_container_type: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> memoryview: ...
|
||||
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_mv_container_type]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@overload
|
||||
def __setitem__(self, i: int, o: bytes) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: memoryview) -> None: ...
|
||||
|
||||
def tobytes(self) -> bytes: ...
|
||||
def tolist(self) -> List[int]: ...
|
||||
|
||||
|
||||
class bool(int):
|
||||
def __init__(self, o: object = ...) -> None: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __and__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __and__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __or__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __or__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __xor__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __xor__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rand__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rand__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __ror__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __ror__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rxor__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rxor__(self, x: int) -> int: ...
|
||||
def __getnewargs__(self) -> Tuple[int]: ...
|
||||
|
||||
class slice(object):
|
||||
start = ... # type: Optional[int]
|
||||
step = ... # type: Optional[int]
|
||||
stop = ... # type: Optional[int]
|
||||
start: Optional[int]
|
||||
step: Optional[int]
|
||||
stop: Optional[int]
|
||||
@overload
|
||||
def __init__(self, stop: Optional[int]) -> None: ...
|
||||
@overload
|
||||
@@ -535,9 +605,9 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
def index(self, x: Any) -> int: ...
|
||||
|
||||
class function:
|
||||
# TODO name of the class (corresponds to Python 'function' class)
|
||||
__name__ = ... # type: str
|
||||
__module__ = ... # type: str
|
||||
# TODO not defined in builtins!
|
||||
__name__: str
|
||||
__module__: str
|
||||
|
||||
class list(MutableSequence[_T], Generic[_T]):
|
||||
@overload
|
||||
@@ -562,16 +632,16 @@ class list(MutableSequence[_T], Generic[_T]):
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> List[_T]: ...
|
||||
def __getslice__(self, start: int, stop: int) -> List[_T]: ...
|
||||
@overload
|
||||
def __setitem__(self, i: int, o: _T) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
|
||||
def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ...
|
||||
def __delitem__(self, i: Union[int, slice]) -> None: ...
|
||||
def __getslice__(self, start: int, stop: int) -> List[_T]: ...
|
||||
def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ...
|
||||
def __delslice__(self, start: int, stop: int) -> None: ...
|
||||
def __add__(self, x: List[_T]) -> List[_T]: ...
|
||||
def __iadd__(self, x: Iterable[_T]) -> List[_T]: ...
|
||||
def __iadd__(self: _S, x: Iterable[_T]) -> _S: ...
|
||||
def __mul__(self, n: int) -> List[_T]: ...
|
||||
def __rmul__(self, n: int) -> List[_T]: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
@@ -612,10 +682,10 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def viewitems(self) -> ItemsView[_KT, _VT]: ...
|
||||
@staticmethod
|
||||
@overload
|
||||
def fromkeys(seq: Sequence[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method (mypy/issues#328)
|
||||
def fromkeys(seq: Iterable[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method (mypy/issues#328)
|
||||
@staticmethod
|
||||
@overload
|
||||
def fromkeys(seq: Sequence[_T], value: _S) -> Dict[_T, _S]: ...
|
||||
def fromkeys(seq: Iterable[_T], value: _S) -> Dict[_T, _S]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __getitem__(self, k: _KT) -> _VT: ...
|
||||
def __setitem__(self, k: _KT, v: _VT) -> None: ...
|
||||
@@ -633,9 +703,9 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
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: Iterable[object]) -> bool: ...
|
||||
def issubset(self, s: Iterable[object]) -> bool: ...
|
||||
def issuperset(self, s: Iterable[object]) -> bool: ...
|
||||
def isdisjoint(self, s: Iterable[Any]) -> bool: ...
|
||||
def issubset(self, s: Iterable[Any]) -> bool: ...
|
||||
def issuperset(self, s: Iterable[Any]) -> bool: ...
|
||||
def pop(self) -> _T: ...
|
||||
def remove(self, element: _T) -> None: ...
|
||||
def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ...
|
||||
@@ -660,10 +730,7 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
def __gt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
|
||||
class frozenset(AbstractSet[_T], Generic[_T]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
|
||||
def copy(self) -> FrozenSet[_T]: ...
|
||||
def difference(self, *s: Iterable[object]) -> FrozenSet[_T]: ...
|
||||
def intersection(self, *s: Iterable[object]) -> FrozenSet[_T]: ...
|
||||
@@ -689,7 +756,7 @@ class enumerate(Iterator[Tuple[int, _T]], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T], start: int = ...) -> None: ...
|
||||
def __iter__(self) -> Iterator[Tuple[int, _T]]: ...
|
||||
def next(self) -> Tuple[int, _T]: ...
|
||||
# TODO __getattribute__
|
||||
|
||||
|
||||
class xrange(Sized, Iterable[int], Reversible[int]):
|
||||
@overload
|
||||
@@ -704,7 +771,8 @@ class xrange(Sized, Iterable[int], Reversible[int]):
|
||||
class property(object):
|
||||
def __init__(self, fget: Optional[Callable[[Any], Any]] = ...,
|
||||
fset: Optional[Callable[[Any, Any], None]] = ...,
|
||||
fdel: Optional[Callable[[Any], None]] = ..., doc: Optional[str] = ...) -> None: ...
|
||||
fdel: Optional[Callable[[Any], None]] = ...,
|
||||
doc: Optional[str] = ...) -> None: ...
|
||||
def getter(self, fget: Callable[[Any], Any]) -> property: ...
|
||||
def setter(self, fset: Callable[[Any, Any], None]) -> property: ...
|
||||
def deleter(self, fdel: Callable[[Any], None]) -> property: ...
|
||||
@@ -716,24 +784,26 @@ class property(object):
|
||||
def fdel(self) -> None: ...
|
||||
|
||||
long = int
|
||||
bytes = str
|
||||
|
||||
NotImplemented = ... # type: Any
|
||||
NotImplemented: Any
|
||||
|
||||
def abs(n: SupportsAbs[_T]) -> _T: ...
|
||||
def all(i: Iterable[object]) -> bool: ...
|
||||
def any(i: Iterable[object]) -> bool: ...
|
||||
def apply(func: Callable[..., _T], args: Optional[Sequence[Any]] = ..., kwds: Optional[Mapping[str, Any]] = ...) -> _T: ...
|
||||
def bin(number: int) -> str: ...
|
||||
def callable(o: object) -> bool: ...
|
||||
def chr(code: int) -> str: ...
|
||||
def compile(source: Any, filename: unicode, mode: str, flags: int = ...,
|
||||
dont_inherit: int = ...) -> Any: ...
|
||||
def delattr(o: Any, name: unicode) -> None: ...
|
||||
def cmp(x: Any, y: Any) -> int: ...
|
||||
_N1 = TypeVar('_N1', bool, int, float, complex)
|
||||
def coerce(x: _N1, y: _N1) -> Tuple[_N1, _N1]: ...
|
||||
def compile(source: Union[Text, mod], filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ...
|
||||
def delattr(o: Any, name: Text) -> None: ...
|
||||
def dir(o: object = ...) -> List[str]: ...
|
||||
@overload
|
||||
def divmod(a: int, b: int) -> Tuple[int, int]: ...
|
||||
@overload
|
||||
def divmod(a: float, b: float) -> Tuple[float, float]: ...
|
||||
_N2 = TypeVar('_N2', int, float)
|
||||
def divmod(a: _N2, b: _N2) -> Tuple[_N2, _N2]: ...
|
||||
def eval(source: Union[Text, bytes, CodeType], globals: Optional[Dict[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> Any: ...
|
||||
def execfile(filename: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Dict[str, Any]] = ...) -> None: ...
|
||||
def exit(code: Any = ...) -> NoReturn: ...
|
||||
@overload
|
||||
def filter(__function: Callable[[AnyStr], Any], # type: ignore
|
||||
@@ -751,8 +821,9 @@ def filter(__function: None,
|
||||
def filter(__function: Callable[[_T], Any],
|
||||
__iterable: Iterable[_T]) -> List[_T]: ...
|
||||
def format(o: object, format_spec: str = ...) -> str: ... # TODO unicode
|
||||
def getattr(o: Any, name: unicode, default: Optional[Any] = ...) -> Any: ...
|
||||
def hasattr(o: Any, name: unicode) -> bool: ...
|
||||
def getattr(o: Any, name: Text, default: Any = ...) -> Any: ...
|
||||
def globals() -> Dict[str, Any]: ...
|
||||
def hasattr(o: Any, name: Text) -> bool: ...
|
||||
def hash(o: object) -> int: ...
|
||||
def hex(i: int) -> str: ... # TODO __index__
|
||||
def id(o: object) -> int: ...
|
||||
@@ -765,6 +836,7 @@ def iter(function: Callable[[], _T], sentinel: _T) -> Iterator[_T]: ...
|
||||
def isinstance(o: object, t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def issubclass(cls: type, classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def len(o: Sized) -> int: ...
|
||||
def locals() -> Dict[str, Any]: ...
|
||||
@overload
|
||||
def map(func: None, iter1: Iterable[_T1]) -> List[_T1]: ...
|
||||
@overload
|
||||
@@ -844,33 +916,25 @@ def next(i: Iterator[_T]) -> _T: ...
|
||||
@overload
|
||||
def next(i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
|
||||
def oct(i: int) -> str: ... # TODO __index__
|
||||
@overload
|
||||
def open(file: str, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
|
||||
@overload
|
||||
def open(file: unicode, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
|
||||
@overload
|
||||
def open(file: int, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
|
||||
def ord(c: unicode) -> int: ...
|
||||
def open(file: Union[unicode, int], mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
|
||||
def ord(c: Union[Text, bytes]) -> int: ...
|
||||
# This is only available after from __future__ import print_function.
|
||||
def print(*values: Any, sep: unicode = ..., end: unicode = ...,
|
||||
file: IO[Any] = ...) -> None: ...
|
||||
def print(*values: Any, sep: Text = ..., end: Text = ..., file: Optional[IO[Any]] = ...) -> None: ...
|
||||
@overload
|
||||
def pow(x: int, y: int) -> Any: ... # The return type can be int or float, depending on y.
|
||||
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: ...
|
||||
def quit(code: Optional[int] = ...) -> None: ...
|
||||
def range(x: int, y: int = ..., step: int = ...) -> List[int]: ...
|
||||
def raw_input(prompt: Any = ...) -> str: ...
|
||||
|
||||
@overload
|
||||
def reduce(function: Callable[[_T, _S], _T], iterable: Iterable[_S], initializer: _T) -> _T: ...
|
||||
@overload
|
||||
def reduce(function: Callable[[_T, _T], _T], iterable: Iterable[_T]) -> _T: ...
|
||||
|
||||
def reload(module: Any) -> Any: ...
|
||||
@overload
|
||||
def reversed(object: Sequence[_T]) -> Iterator[_T]: ...
|
||||
@@ -880,12 +944,12 @@ def repr(o: object) -> str: ...
|
||||
@overload
|
||||
def round(number: float) -> float: ...
|
||||
@overload
|
||||
def round(number: float, ndigits: int) -> float: ... # Always return a float if given ndigits.
|
||||
def round(number: float, ndigits: int) -> float: ...
|
||||
@overload
|
||||
def round(number: SupportsRound[_T]) -> _T: ...
|
||||
@overload
|
||||
def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
|
||||
def setattr(object: Any, name: unicode, value: Any) -> None: ...
|
||||
def setattr(object: Any, name: Text, value: Any) -> None: ...
|
||||
def sorted(iterable: Iterable[_T], *,
|
||||
cmp: Callable[[_T, _T], int] = ...,
|
||||
key: Callable[[_T], Any] = ...,
|
||||
@@ -906,28 +970,21 @@ def zip(iter1: Iterable[_T1], iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2,
|
||||
_T3, _T4]]: ...
|
||||
iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2, _T3, _T4]]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2,
|
||||
_T3, _T4, _T5]]: ...
|
||||
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any],
|
||||
iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any],
|
||||
*iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ...
|
||||
def __import__(name: unicode,
|
||||
globals: Dict[str, Any] = ...,
|
||||
locals: Dict[str, Any] = ...,
|
||||
def __import__(name: Text, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...,
|
||||
fromlist: List[str] = ..., level: int = ...) -> Any: ...
|
||||
|
||||
def globals() -> Dict[str, Any]: ...
|
||||
def locals() -> Dict[str, Any]: ...
|
||||
|
||||
# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
|
||||
# not exposed anywhere under that name, we make it private here.
|
||||
class ellipsis: ...
|
||||
Ellipsis = ... # type: ellipsis
|
||||
Ellipsis: ellipsis
|
||||
|
||||
# TODO: buffer support is incomplete; e.g. some_string.startswith(some_buffer) doesn't type check.
|
||||
_AnyBuffer = TypeVar('_AnyBuffer', str, unicode, bytearray, buffer)
|
||||
@@ -941,39 +998,9 @@ class buffer(Sized):
|
||||
def __len__(self) -> int: ...
|
||||
def __mul__(self, x: int) -> str: ...
|
||||
|
||||
class memoryview(Sized, Container[bytes]):
|
||||
format = ... # type: str
|
||||
itemsize = ... # type: int
|
||||
shape = ... # type: Optional[Tuple[int, ...]]
|
||||
strides = ... # type: Optional[Tuple[int, ...]]
|
||||
suboffsets = ... # type: Optional[Tuple[int, ...]]
|
||||
readonly = ... # type: bool
|
||||
ndim = ... # type: int
|
||||
|
||||
def __init__(self, obj: Union[str, bytearray, buffer, memoryview]) -> None: ...
|
||||
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> bytes: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> memoryview: ...
|
||||
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@overload
|
||||
def __setitem__(self, i: int, o: bytes) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: memoryview) -> None: ...
|
||||
|
||||
def tobytes(self) -> bytes: ...
|
||||
def tolist(self) -> List[int]: ...
|
||||
|
||||
class BaseException(object):
|
||||
args = ... # type: Tuple[Any, ...]
|
||||
message = ... # type: Any
|
||||
args: Tuple[Any, ...]
|
||||
message: Any
|
||||
def __init__(self, *args: object) -> None: ...
|
||||
def __getitem__(self, i: int) -> Any: ...
|
||||
def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ...
|
||||
@@ -981,66 +1008,76 @@ class BaseException(object):
|
||||
class GeneratorExit(BaseException): ...
|
||||
class KeyboardInterrupt(BaseException): ...
|
||||
class SystemExit(BaseException):
|
||||
code = 0
|
||||
code: int
|
||||
class Exception(BaseException): ...
|
||||
class StopIteration(Exception): ...
|
||||
class StopIteration(Exception):
|
||||
class StandardError(Exception): ...
|
||||
class ArithmeticError(StandardError): ...
|
||||
class BufferError(StandardError): ...
|
||||
_StandardError = StandardError
|
||||
class EnvironmentError(StandardError):
|
||||
errno = 0
|
||||
strerror = ... # type: str
|
||||
errno: int
|
||||
strerror: str
|
||||
# TODO can this be unicode?
|
||||
filename = ... # type: str
|
||||
class LookupError(StandardError): ...
|
||||
class RuntimeError(StandardError): ...
|
||||
class ValueError(StandardError): ...
|
||||
class AssertionError(StandardError): ...
|
||||
class AttributeError(StandardError): ...
|
||||
class EOFError(StandardError): ...
|
||||
class FloatingPointError(ArithmeticError): ...
|
||||
filename: str
|
||||
class OSError(EnvironmentError): ...
|
||||
class IOError(EnvironmentError): ...
|
||||
class ImportError(StandardError): ...
|
||||
|
||||
class ArithmeticError(_StandardError): ...
|
||||
class AssertionError(_StandardError): ...
|
||||
class AttributeError(_StandardError): ...
|
||||
class BufferError(_StandardError): ...
|
||||
class EOFError(_StandardError): ...
|
||||
class ImportError(_StandardError):
|
||||
class LookupError(_StandardError): ...
|
||||
class MemoryError(_StandardError): ...
|
||||
class NameError(_StandardError): ...
|
||||
class ReferenceError(_StandardError): ...
|
||||
class RuntimeError(_StandardError): ...
|
||||
class SyntaxError(_StandardError):
|
||||
msg: str
|
||||
lineno: int
|
||||
offset: Optional[int]
|
||||
text: str
|
||||
filename: str
|
||||
class SystemError(_StandardError): ...
|
||||
class TypeError(_StandardError): ...
|
||||
class ValueError(_StandardError): ...
|
||||
|
||||
class FloatingPointError(ArithmeticError): ...
|
||||
class OverflowError(ArithmeticError): ...
|
||||
class ZeroDivisionError(ArithmeticError): ...
|
||||
|
||||
|
||||
class IndexError(LookupError): ...
|
||||
class KeyError(LookupError): ...
|
||||
class MemoryError(StandardError): ...
|
||||
class NameError(StandardError): ...
|
||||
class NotImplementedError(RuntimeError): ...
|
||||
class OSError(EnvironmentError): ...
|
||||
|
||||
class UnboundLocalError(NameError): ...
|
||||
|
||||
class WindowsError(OSError):
|
||||
winerror = ... # type: int
|
||||
class OverflowError(ArithmeticError): ...
|
||||
class ReferenceError(StandardError): ...
|
||||
class SyntaxError(StandardError):
|
||||
msg = ... # type: str
|
||||
lineno = ... # type: int
|
||||
offset = ... # type: int
|
||||
text = ... # type: str
|
||||
filename = ... # type: str
|
||||
winerror: int
|
||||
|
||||
class NotImplementedError(RuntimeError): ...
|
||||
|
||||
class IndentationError(SyntaxError): ...
|
||||
class TabError(IndentationError): ...
|
||||
class SystemError(StandardError): ...
|
||||
class TypeError(StandardError): ...
|
||||
class UnboundLocalError(NameError): ...
|
||||
|
||||
class UnicodeError(ValueError): ...
|
||||
class UnicodeDecodeError(UnicodeError):
|
||||
encoding: bytes
|
||||
encoding: str
|
||||
object: bytes
|
||||
start: int
|
||||
end: int
|
||||
reason: bytes
|
||||
def __init__(self, __encoding: bytes, __object: bytes, __start: int, __end: int,
|
||||
__reason: bytes) -> None: ...
|
||||
reason: str
|
||||
def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int,
|
||||
__reason: str) -> None: ...
|
||||
class UnicodeEncodeError(UnicodeError):
|
||||
encoding: bytes
|
||||
object: unicode
|
||||
encoding: str
|
||||
object: Text
|
||||
start: int
|
||||
end: int
|
||||
reason: bytes
|
||||
def __init__(self, __encoding: bytes, __object: unicode, __start: int, __end: int,
|
||||
__reason: bytes) -> None: ...
|
||||
reason: str
|
||||
def __init__(self, __encoding: str, __object: Text, __start: int, __end: int,
|
||||
__reason: str) -> None: ...
|
||||
class UnicodeTranslateError(UnicodeError): ...
|
||||
class ZeroDivisionError(ArithmeticError): ...
|
||||
|
||||
class Warning(Exception): ...
|
||||
class UserWarning(Warning): ...
|
||||
@@ -1053,15 +1090,6 @@ class ImportWarning(Warning): ...
|
||||
class UnicodeWarning(Warning): ...
|
||||
class BytesWarning(Warning): ...
|
||||
|
||||
def eval(s: Union[str, unicode], globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> Any: ...
|
||||
def exec(object: str,
|
||||
globals: Optional[Dict[str, Any]] = ...,
|
||||
locals: Optional[Dict[str, Any]] = ...) -> Any: ... # TODO code object as source
|
||||
|
||||
def cmp(x: Any, y: Any) -> int: ...
|
||||
|
||||
def execfile(filename: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Dict[str, Any]] = ...) -> None: ...
|
||||
|
||||
class file(BinaryIO):
|
||||
@overload
|
||||
def __init__(self, file: str, mode: str = ..., buffering: int = ...) -> None: ...
|
||||
@@ -1089,8 +1117,3 @@ class file(BinaryIO):
|
||||
def write(self, data: str) -> int: ...
|
||||
def writelines(self, data: Iterable[str]) -> None: ...
|
||||
def truncate(self, pos: Optional[int] = ...) -> int: ...
|
||||
|
||||
# Very old builtins
|
||||
def apply(func: Callable[..., _T], args: Optional[Sequence[Any]] = ..., kwds: Optional[Mapping[str, Any]] = ...) -> _T: ...
|
||||
_N = TypeVar('_N', bool, int, float, complex)
|
||||
def coerce(x: _N, y: _N) -> Tuple[_N, _N]: ...
|
||||
|
||||
@@ -100,7 +100,7 @@ class _RawIOBase(_IOBase):
|
||||
def readall(self) -> str: ...
|
||||
def read(self, n: int = ...) -> str: ...
|
||||
|
||||
class FileIO(_RawIOBase, BytesIO): # type: ignore # for __enter__
|
||||
class FileIO(_RawIOBase, BytesIO):
|
||||
mode = ... # type: str
|
||||
closefd = ... # type: bool
|
||||
def __init__(self, file: Union[str, int], mode: str = ..., closefd: bool = ...) -> None: ...
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
# NB: __builtin__.pyi and builtins.pyi must remain consistent!
|
||||
# Stubs for builtins (Python 2.7)
|
||||
|
||||
# True and False are deliberately omitted because they are keywords in
|
||||
# Python 3, and stub files conform to Python 3 syntax.
|
||||
|
||||
from typing import (
|
||||
TypeVar, Iterator, Iterable, NoReturn, overload,
|
||||
Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set,
|
||||
AbstractSet, FrozenSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
|
||||
SupportsComplex, SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping,
|
||||
MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, Type
|
||||
TypeVar, Iterator, Iterable, NoReturn, overload, Container,
|
||||
Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic,
|
||||
Set, AbstractSet, FrozenSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
|
||||
SupportsComplex, SupportsRound, IO, BinaryIO, Union,
|
||||
ItemsView, KeysView, ValuesView, ByteString, Optional, AnyStr, Type, Text,
|
||||
)
|
||||
from abc import abstractmethod, ABCMeta
|
||||
from ast import mod
|
||||
from types import TracebackType, CodeType
|
||||
import sys
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T_co = TypeVar('_T_co', covariant=True)
|
||||
@@ -26,12 +26,15 @@ _T5 = TypeVar('_T5')
|
||||
_TT = TypeVar('_TT', bound='type')
|
||||
|
||||
class object:
|
||||
__doc__ = ... # type: Optional[str]
|
||||
__class__ = ... # type: type
|
||||
__dict__ = ... # type: Dict[str, Any]
|
||||
__slots__ = ... # type: Union[str, unicode, Iterable[Union[str, unicode]]]
|
||||
__module__ = ... # type: str
|
||||
__doc__: Optional[str]
|
||||
__dict__: Dict[str, Any]
|
||||
__slots__: Union[Text, Iterable[Text]]
|
||||
__module__: str
|
||||
|
||||
@property
|
||||
def __class__(self: _T) -> Type[_T]: ...
|
||||
@__class__.setter
|
||||
def __class__(self, __type: Type[object]) -> None: ...
|
||||
def __init__(self) -> None: ...
|
||||
def __new__(cls) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||
@@ -48,49 +51,69 @@ class object:
|
||||
def __reduce_ex__(self, protocol: int) -> tuple: ...
|
||||
|
||||
class staticmethod(object): # Special, only valid as a decorator.
|
||||
__func__ = ... # type: function
|
||||
__func__: Callable
|
||||
|
||||
def __init__(self, f: function) -> None: ...
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
|
||||
class classmethod(object): # Special, only valid as a decorator.
|
||||
__func__ = ... # type: function
|
||||
__func__: Callable
|
||||
|
||||
def __init__(self, f: function) -> None: ...
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
|
||||
class type(object):
|
||||
__bases__ = ... # type: Tuple[type, ...]
|
||||
__name__ = ... # type: str
|
||||
__module__ = ... # type: str
|
||||
__base__: type
|
||||
__bases__: Tuple[type, ...]
|
||||
__basicsize__: int
|
||||
__dict__: Dict[str, Any]
|
||||
__dictoffset__: int
|
||||
__flags__: int
|
||||
__itemsize__: int
|
||||
__module__: str
|
||||
__mro__: Tuple[type, ...]
|
||||
__name__: str
|
||||
__weakrefoffset__: int
|
||||
|
||||
@overload
|
||||
def __init__(self, o: object) -> None: ...
|
||||
@overload
|
||||
def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any]) -> None: ...
|
||||
# TODO: __new__ may have to be special and not a static method.
|
||||
@overload
|
||||
def __new__(cls, o: object) -> type: ...
|
||||
@overload
|
||||
def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ...
|
||||
def __call__(self, *args: Any, **kwds: Any) -> Any: ...
|
||||
|
||||
# Only new-style classes
|
||||
__mro__ = ... # type: Tuple[type, ...]
|
||||
def __subclasses__(self: _TT) -> List[_TT]: ...
|
||||
# Note: the documentation doesnt specify what the return type is, the standard
|
||||
# implementation seems to be returning a list.
|
||||
def mro(self) -> List[type]: ...
|
||||
def __subclasses__(self: _TT) -> List[_TT]: ...
|
||||
def __instancecheck__(self, instance: Any) -> bool: ...
|
||||
def __subclasscheck__(self, subclass: type) -> bool: ...
|
||||
|
||||
class super(object):
|
||||
@overload
|
||||
def __init__(self, t: Any, obj: Any) -> None: ...
|
||||
@overload
|
||||
def __init__(self, t: Any) -> None: ...
|
||||
|
||||
class int:
|
||||
@overload
|
||||
def __init__(self, x: SupportsInt = ...) -> None: ...
|
||||
def __init__(self, x: Union[Text, bytes, SupportsInt] = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: Union[str, unicode, bytearray], base: int = ...) -> None: ...
|
||||
def __init__(self, x: Union[Text, bytes, bytearray], base: int) -> None: ...
|
||||
|
||||
@property
|
||||
def real(self) -> int: ...
|
||||
@property
|
||||
def imag(self) -> int: ...
|
||||
@property
|
||||
def numerator(self) -> int: ...
|
||||
@property
|
||||
def denominator(self) -> int: ...
|
||||
def conjugate(self) -> int: ...
|
||||
|
||||
def bit_length(self) -> int: ...
|
||||
|
||||
@@ -125,6 +148,7 @@ class int:
|
||||
def __neg__(self) -> int: ...
|
||||
def __pos__(self) -> int: ...
|
||||
def __invert__(self) -> int: ...
|
||||
def __getnewargs__(self) -> Tuple[int]: ...
|
||||
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
@@ -142,13 +166,19 @@ class int:
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
class float:
|
||||
def __init__(self, x: Union[SupportsFloat, str, unicode, bytearray] = ...) -> None: ...
|
||||
def __init__(self, x: Union[SupportsFloat, Text, bytes, bytearray] = ...) -> 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: ...
|
||||
|
||||
@property
|
||||
def real(self) -> float: ...
|
||||
@property
|
||||
def imag(self) -> float: ...
|
||||
def conjugate(self) -> float: ...
|
||||
|
||||
def __add__(self, x: float) -> float: ...
|
||||
def __sub__(self, x: float) -> float: ...
|
||||
def __mul__(self, x: float) -> float: ...
|
||||
@@ -157,7 +187,7 @@ class float:
|
||||
def __truediv__(self, x: float) -> float: ...
|
||||
def __mod__(self, x: float) -> float: ...
|
||||
def __divmod__(self, x: float) -> Tuple[float, float]: ...
|
||||
def __pow__(self, x: float) -> float: ...
|
||||
def __pow__(self, x: float) -> float: ... # In Python 3, returns complex if self is negative and x is not whole
|
||||
def __radd__(self, x: float) -> float: ...
|
||||
def __rsub__(self, x: float) -> float: ...
|
||||
def __rmul__(self, x: float) -> float: ...
|
||||
@@ -167,6 +197,7 @@ class float:
|
||||
def __rmod__(self, x: float) -> float: ...
|
||||
def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
|
||||
def __rpow__(self, x: float) -> float: ...
|
||||
def __getnewargs__(self) -> Tuple[float]: ...
|
||||
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
@@ -217,18 +248,12 @@ class complex:
|
||||
def __neg__(self) -> complex: ...
|
||||
def __pos__(self) -> complex: ...
|
||||
|
||||
def __complex__(self) -> complex: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __complex__(self) -> complex: ...
|
||||
def __abs__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __nonzero__(self) -> bool: ...
|
||||
|
||||
class super(object):
|
||||
@overload
|
||||
def __init__(self, t: Any, obj: Any) -> None: ...
|
||||
@overload
|
||||
def __init__(self, t: Any) -> None: ...
|
||||
|
||||
class basestring(metaclass=ABCMeta): ...
|
||||
|
||||
class unicode(basestring, Sequence[unicode]):
|
||||
@@ -308,19 +333,22 @@ class unicode(basestring, Sequence[unicode]):
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __getnewargs__(self) -> Tuple[unicode]: ...
|
||||
|
||||
class str(basestring, Sequence[str]):
|
||||
def __init__(self, object: object = ...) -> None: ...
|
||||
_str_base = basestring
|
||||
|
||||
class str(Sequence[str], _str_base):
|
||||
def __init__(self, o: object = ...) -> None: ...
|
||||
def capitalize(self) -> str: ...
|
||||
def center(self, width: int, fillchar: str = ...) -> str: ...
|
||||
def count(self, x: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ...
|
||||
def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ...
|
||||
def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]]) -> bool: ...
|
||||
def count(self, x: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ...
|
||||
def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ...
|
||||
def endswith(self, suffix: Union[Text, Tuple[Text, ...]]) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> str: ...
|
||||
def find(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def format(self, *args: Any, **kwargs: Any) -> str: ...
|
||||
def index(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
def isalpha(self) -> bool: ...
|
||||
def isdigit(self) -> bool: ...
|
||||
@@ -342,8 +370,8 @@ class str(basestring, Sequence[str]):
|
||||
@overload
|
||||
def partition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
|
||||
def replace(self, old: AnyStr, new: AnyStr, count: int = ...) -> AnyStr: ...
|
||||
def rfind(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rindex(self, sub: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rfind(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rindex(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rjust(self, width: int, fillchar: str = ...) -> str: ...
|
||||
@overload
|
||||
def rpartition(self, sep: bytearray) -> Tuple[str, bytearray, str]: ...
|
||||
@@ -364,7 +392,7 @@ class str(basestring, Sequence[str]):
|
||||
@overload
|
||||
def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[str]: ...
|
||||
def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]]) -> bool: ...
|
||||
def startswith(self, prefix: Union[Text, Tuple[Text, ...]]) -> bool: ...
|
||||
@overload
|
||||
def strip(self, chars: str = ...) -> str: ...
|
||||
@overload
|
||||
@@ -375,45 +403,48 @@ class str(basestring, Sequence[str]):
|
||||
def upper(self) -> str: ...
|
||||
def zfill(self, width: int) -> str: ...
|
||||
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
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) -> str: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> str: ...
|
||||
def __getslice__(self, start: int, stop: int) -> str: ...
|
||||
def __add__(self, s: AnyStr) -> AnyStr: ...
|
||||
def __mul__(self, n: int) -> str: ...
|
||||
def __rmul__(self, n: int) -> str: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __lt__(self, x: unicode) -> bool: ...
|
||||
def __le__(self, x: unicode) -> bool: ...
|
||||
def __gt__(self, x: unicode) -> bool: ...
|
||||
def __ge__(self, x: unicode) -> bool: ...
|
||||
def __ge__(self, x: Text) -> bool: ...
|
||||
def __getitem__(self, i: Union[int, slice]) -> str: ...
|
||||
def __gt__(self, x: Text) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __le__(self, x: Text) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __lt__(self, x: Text) -> bool: ...
|
||||
def __mod__(self, x: Any) -> str: ...
|
||||
def __mul__(self, n: int) -> str: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __rmul__(self, n: int) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __getnewargs__(self) -> Tuple[str]: ...
|
||||
|
||||
class bytearray(MutableSequence[int]):
|
||||
def __getslice__(self, start: int, stop: int) -> str: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __int__(self) -> int: ...
|
||||
|
||||
|
||||
bytes = str
|
||||
|
||||
class bytearray(MutableSequence[int], ByteString):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: Union[Iterable[int], str]) -> None: ...
|
||||
def __init__(self, ints: Iterable[int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: unicode, encoding: unicode,
|
||||
errors: unicode = ...) -> None: ...
|
||||
def __init__(self, string: str) -> None: ...
|
||||
@overload
|
||||
def __init__(self, string: Text, encoding: Text, errors: Text = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, length: int) -> None: ...
|
||||
def capitalize(self) -> bytearray: ...
|
||||
def center(self, width: int, fillchar: str = ...) -> bytearray: ...
|
||||
def center(self, width: int, fillchar: bytes = ...) -> bytearray: ...
|
||||
def count(self, x: str) -> int: ...
|
||||
def decode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ...
|
||||
def endswith(self, suffix: Union[str, Tuple[str, ...]]) -> bool: ...
|
||||
def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ...
|
||||
def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> bytearray: ...
|
||||
def find(self, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
def index(self, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
@@ -428,26 +459,31 @@ class bytearray(MutableSequence[int]):
|
||||
def join(self, iterable: Iterable[str]) -> bytearray: ...
|
||||
def ljust(self, width: int, fillchar: str = ...) -> bytearray: ...
|
||||
def lower(self) -> bytearray: ...
|
||||
def lstrip(self, chars: str = ...) -> bytearray: ...
|
||||
def partition(self, sep: str) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def replace(self, old: str, new: str, count: int = ...) -> bytearray: ...
|
||||
def rfind(self, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
def rindex(self, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
def rjust(self, width: int, fillchar: str = ...) -> bytearray: ...
|
||||
def rpartition(self, sep: str) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def rstrip(self, chars: str = ...) -> bytearray: ...
|
||||
def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def lstrip(self, chars: Optional[bytes] = ...) -> bytearray: ...
|
||||
def partition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def replace(self, old: bytes, new: bytes, count: int = ...) -> bytearray: ...
|
||||
def rfind(self, sub: bytes, start: int = ..., end: int = ...) -> int: ...
|
||||
def rindex(self, sub: bytes, start: int = ..., end: int = ...) -> int: ...
|
||||
def rjust(self, width: int, fillchar: bytes = ...) -> bytearray: ...
|
||||
def rpartition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def rsplit(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def rstrip(self, chars: Optional[bytes] = ...) -> bytearray: ...
|
||||
def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
|
||||
def startswith(self, prefix: Union[str, Tuple[str, ...]]) -> bool: ...
|
||||
def strip(self, chars: str = ...) -> bytearray: ...
|
||||
def startswith(
|
||||
self,
|
||||
prefix: Union[bytes, Tuple[bytes, ...]],
|
||||
start: Optional[int] = ...,
|
||||
end: Optional[int] = ...,
|
||||
) -> bool: ...
|
||||
def strip(self, chars: Optional[bytes] = ...) -> bytearray: ...
|
||||
def swapcase(self) -> bytearray: ...
|
||||
def title(self) -> bytearray: ...
|
||||
def translate(self, table: str) -> bytearray: ...
|
||||
def upper(self) -> bytearray: ...
|
||||
def zfill(self, width: int) -> bytearray: ...
|
||||
@staticmethod
|
||||
def fromhex(x: str) -> bytearray: ...
|
||||
def fromhex(s: str) -> bytearray: ...
|
||||
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[int]: ...
|
||||
@@ -460,55 +496,89 @@ class bytearray(MutableSequence[int]):
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> bytearray: ...
|
||||
def __getslice__(self, start: int, stop: int) -> bytearray: ...
|
||||
@overload
|
||||
def __setitem__(self, i: int, x: int) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, x: Union[Iterable[int], str]) -> None: ...
|
||||
def __setslice__(self, start: int, stop: int, x: Union[Sequence[int], str]) -> None: ...
|
||||
def __setitem__(self, s: slice, x: Union[Iterable[int], bytes]) -> None: ...
|
||||
def __delitem__(self, i: Union[int, slice]) -> None: ...
|
||||
def __getslice__(self, start: int, stop: int) -> bytearray: ...
|
||||
def __setslice__(self, start: int, stop: int, x: Union[Sequence[int], str]) -> None: ...
|
||||
def __delslice__(self, start: int, stop: int) -> None: ...
|
||||
def __add__(self, s: str) -> bytearray: ...
|
||||
def __add__(self, s: bytes) -> bytearray: ...
|
||||
def __mul__(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: str) -> bool: ...
|
||||
def __le__(self, x: str) -> bool: ...
|
||||
def __gt__(self, x: str) -> bool: ...
|
||||
def __ge__(self, x: str) -> 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: ...
|
||||
|
||||
_mv_container_type = str
|
||||
|
||||
class memoryview(Sized, Container[_mv_container_type]):
|
||||
format: str
|
||||
itemsize: int
|
||||
shape: Optional[Tuple[int, ...]]
|
||||
strides: Optional[Tuple[int, ...]]
|
||||
suboffsets: Optional[Tuple[int, ...]]
|
||||
readonly: bool
|
||||
ndim: int
|
||||
|
||||
def __init__(self, obj: Union[bytes, bytearray, buffer, memoryview]) -> None: ...
|
||||
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> _mv_container_type: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> memoryview: ...
|
||||
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_mv_container_type]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@overload
|
||||
def __setitem__(self, i: int, o: bytes) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: memoryview) -> None: ...
|
||||
|
||||
def tobytes(self) -> bytes: ...
|
||||
def tolist(self) -> List[int]: ...
|
||||
|
||||
|
||||
class bool(int):
|
||||
def __init__(self, o: object = ...) -> None: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __and__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __and__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __or__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __or__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __xor__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __xor__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rand__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rand__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __ror__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __ror__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rxor__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rxor__(self, x: int) -> int: ...
|
||||
def __getnewargs__(self) -> Tuple[int]: ...
|
||||
|
||||
class slice(object):
|
||||
start = ... # type: Optional[int]
|
||||
step = ... # type: Optional[int]
|
||||
stop = ... # type: Optional[int]
|
||||
start: Optional[int]
|
||||
step: Optional[int]
|
||||
stop: Optional[int]
|
||||
@overload
|
||||
def __init__(self, stop: Optional[int]) -> None: ...
|
||||
@overload
|
||||
@@ -535,9 +605,9 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
def index(self, x: Any) -> int: ...
|
||||
|
||||
class function:
|
||||
# TODO name of the class (corresponds to Python 'function' class)
|
||||
__name__ = ... # type: str
|
||||
__module__ = ... # type: str
|
||||
# TODO not defined in builtins!
|
||||
__name__: str
|
||||
__module__: str
|
||||
|
||||
class list(MutableSequence[_T], Generic[_T]):
|
||||
@overload
|
||||
@@ -562,16 +632,16 @@ class list(MutableSequence[_T], Generic[_T]):
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> List[_T]: ...
|
||||
def __getslice__(self, start: int, stop: int) -> List[_T]: ...
|
||||
@overload
|
||||
def __setitem__(self, i: int, o: _T) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
|
||||
def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ...
|
||||
def __delitem__(self, i: Union[int, slice]) -> None: ...
|
||||
def __getslice__(self, start: int, stop: int) -> List[_T]: ...
|
||||
def __setslice__(self, start: int, stop: int, o: Sequence[_T]) -> None: ...
|
||||
def __delslice__(self, start: int, stop: int) -> None: ...
|
||||
def __add__(self, x: List[_T]) -> List[_T]: ...
|
||||
def __iadd__(self, x: Iterable[_T]) -> List[_T]: ...
|
||||
def __iadd__(self: _S, x: Iterable[_T]) -> _S: ...
|
||||
def __mul__(self, n: int) -> List[_T]: ...
|
||||
def __rmul__(self, n: int) -> List[_T]: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
@@ -612,10 +682,10 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def viewitems(self) -> ItemsView[_KT, _VT]: ...
|
||||
@staticmethod
|
||||
@overload
|
||||
def fromkeys(seq: Sequence[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method (mypy/issues#328)
|
||||
def fromkeys(seq: Iterable[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method (mypy/issues#328)
|
||||
@staticmethod
|
||||
@overload
|
||||
def fromkeys(seq: Sequence[_T], value: _S) -> Dict[_T, _S]: ...
|
||||
def fromkeys(seq: Iterable[_T], value: _S) -> Dict[_T, _S]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __getitem__(self, k: _KT) -> _VT: ...
|
||||
def __setitem__(self, k: _KT, v: _VT) -> None: ...
|
||||
@@ -633,9 +703,9 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
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: Iterable[object]) -> bool: ...
|
||||
def issubset(self, s: Iterable[object]) -> bool: ...
|
||||
def issuperset(self, s: Iterable[object]) -> bool: ...
|
||||
def isdisjoint(self, s: Iterable[Any]) -> bool: ...
|
||||
def issubset(self, s: Iterable[Any]) -> bool: ...
|
||||
def issuperset(self, s: Iterable[Any]) -> bool: ...
|
||||
def pop(self) -> _T: ...
|
||||
def remove(self, element: _T) -> None: ...
|
||||
def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ...
|
||||
@@ -660,10 +730,7 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
def __gt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
|
||||
class frozenset(AbstractSet[_T], Generic[_T]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
|
||||
def copy(self) -> FrozenSet[_T]: ...
|
||||
def difference(self, *s: Iterable[object]) -> FrozenSet[_T]: ...
|
||||
def intersection(self, *s: Iterable[object]) -> FrozenSet[_T]: ...
|
||||
@@ -689,7 +756,7 @@ class enumerate(Iterator[Tuple[int, _T]], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T], start: int = ...) -> None: ...
|
||||
def __iter__(self) -> Iterator[Tuple[int, _T]]: ...
|
||||
def next(self) -> Tuple[int, _T]: ...
|
||||
# TODO __getattribute__
|
||||
|
||||
|
||||
class xrange(Sized, Iterable[int], Reversible[int]):
|
||||
@overload
|
||||
@@ -704,7 +771,8 @@ class xrange(Sized, Iterable[int], Reversible[int]):
|
||||
class property(object):
|
||||
def __init__(self, fget: Optional[Callable[[Any], Any]] = ...,
|
||||
fset: Optional[Callable[[Any, Any], None]] = ...,
|
||||
fdel: Optional[Callable[[Any], None]] = ..., doc: Optional[str] = ...) -> None: ...
|
||||
fdel: Optional[Callable[[Any], None]] = ...,
|
||||
doc: Optional[str] = ...) -> None: ...
|
||||
def getter(self, fget: Callable[[Any], Any]) -> property: ...
|
||||
def setter(self, fset: Callable[[Any, Any], None]) -> property: ...
|
||||
def deleter(self, fdel: Callable[[Any], None]) -> property: ...
|
||||
@@ -716,24 +784,26 @@ class property(object):
|
||||
def fdel(self) -> None: ...
|
||||
|
||||
long = int
|
||||
bytes = str
|
||||
|
||||
NotImplemented = ... # type: Any
|
||||
NotImplemented: Any
|
||||
|
||||
def abs(n: SupportsAbs[_T]) -> _T: ...
|
||||
def all(i: Iterable[object]) -> bool: ...
|
||||
def any(i: Iterable[object]) -> bool: ...
|
||||
def apply(func: Callable[..., _T], args: Optional[Sequence[Any]] = ..., kwds: Optional[Mapping[str, Any]] = ...) -> _T: ...
|
||||
def bin(number: int) -> str: ...
|
||||
def callable(o: object) -> bool: ...
|
||||
def chr(code: int) -> str: ...
|
||||
def compile(source: Any, filename: unicode, mode: str, flags: int = ...,
|
||||
dont_inherit: int = ...) -> Any: ...
|
||||
def delattr(o: Any, name: unicode) -> None: ...
|
||||
def cmp(x: Any, y: Any) -> int: ...
|
||||
_N1 = TypeVar('_N1', bool, int, float, complex)
|
||||
def coerce(x: _N1, y: _N1) -> Tuple[_N1, _N1]: ...
|
||||
def compile(source: Union[Text, mod], filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ...
|
||||
def delattr(o: Any, name: Text) -> None: ...
|
||||
def dir(o: object = ...) -> List[str]: ...
|
||||
@overload
|
||||
def divmod(a: int, b: int) -> Tuple[int, int]: ...
|
||||
@overload
|
||||
def divmod(a: float, b: float) -> Tuple[float, float]: ...
|
||||
_N2 = TypeVar('_N2', int, float)
|
||||
def divmod(a: _N2, b: _N2) -> Tuple[_N2, _N2]: ...
|
||||
def eval(source: Union[Text, bytes, CodeType], globals: Optional[Dict[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> Any: ...
|
||||
def execfile(filename: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Dict[str, Any]] = ...) -> None: ...
|
||||
def exit(code: Any = ...) -> NoReturn: ...
|
||||
@overload
|
||||
def filter(__function: Callable[[AnyStr], Any], # type: ignore
|
||||
@@ -751,8 +821,9 @@ def filter(__function: None,
|
||||
def filter(__function: Callable[[_T], Any],
|
||||
__iterable: Iterable[_T]) -> List[_T]: ...
|
||||
def format(o: object, format_spec: str = ...) -> str: ... # TODO unicode
|
||||
def getattr(o: Any, name: unicode, default: Optional[Any] = ...) -> Any: ...
|
||||
def hasattr(o: Any, name: unicode) -> bool: ...
|
||||
def getattr(o: Any, name: Text, default: Any = ...) -> Any: ...
|
||||
def globals() -> Dict[str, Any]: ...
|
||||
def hasattr(o: Any, name: Text) -> bool: ...
|
||||
def hash(o: object) -> int: ...
|
||||
def hex(i: int) -> str: ... # TODO __index__
|
||||
def id(o: object) -> int: ...
|
||||
@@ -765,6 +836,7 @@ def iter(function: Callable[[], _T], sentinel: _T) -> Iterator[_T]: ...
|
||||
def isinstance(o: object, t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def issubclass(cls: type, classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def len(o: Sized) -> int: ...
|
||||
def locals() -> Dict[str, Any]: ...
|
||||
@overload
|
||||
def map(func: None, iter1: Iterable[_T1]) -> List[_T1]: ...
|
||||
@overload
|
||||
@@ -844,33 +916,25 @@ def next(i: Iterator[_T]) -> _T: ...
|
||||
@overload
|
||||
def next(i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
|
||||
def oct(i: int) -> str: ... # TODO __index__
|
||||
@overload
|
||||
def open(file: str, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
|
||||
@overload
|
||||
def open(file: unicode, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
|
||||
@overload
|
||||
def open(file: int, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
|
||||
def ord(c: unicode) -> int: ...
|
||||
def open(file: Union[unicode, int], mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
|
||||
def ord(c: Union[Text, bytes]) -> int: ...
|
||||
# This is only available after from __future__ import print_function.
|
||||
def print(*values: Any, sep: unicode = ..., end: unicode = ...,
|
||||
file: IO[Any] = ...) -> None: ...
|
||||
def print(*values: Any, sep: Text = ..., end: Text = ..., file: Optional[IO[Any]] = ...) -> None: ...
|
||||
@overload
|
||||
def pow(x: int, y: int) -> Any: ... # The return type can be int or float, depending on y.
|
||||
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: ...
|
||||
def quit(code: Optional[int] = ...) -> None: ...
|
||||
def range(x: int, y: int = ..., step: int = ...) -> List[int]: ...
|
||||
def raw_input(prompt: Any = ...) -> str: ...
|
||||
|
||||
@overload
|
||||
def reduce(function: Callable[[_T, _S], _T], iterable: Iterable[_S], initializer: _T) -> _T: ...
|
||||
@overload
|
||||
def reduce(function: Callable[[_T, _T], _T], iterable: Iterable[_T]) -> _T: ...
|
||||
|
||||
def reload(module: Any) -> Any: ...
|
||||
@overload
|
||||
def reversed(object: Sequence[_T]) -> Iterator[_T]: ...
|
||||
@@ -880,12 +944,12 @@ def repr(o: object) -> str: ...
|
||||
@overload
|
||||
def round(number: float) -> float: ...
|
||||
@overload
|
||||
def round(number: float, ndigits: int) -> float: ... # Always return a float if given ndigits.
|
||||
def round(number: float, ndigits: int) -> float: ...
|
||||
@overload
|
||||
def round(number: SupportsRound[_T]) -> _T: ...
|
||||
@overload
|
||||
def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
|
||||
def setattr(object: Any, name: unicode, value: Any) -> None: ...
|
||||
def setattr(object: Any, name: Text, value: Any) -> None: ...
|
||||
def sorted(iterable: Iterable[_T], *,
|
||||
cmp: Callable[[_T, _T], int] = ...,
|
||||
key: Callable[[_T], Any] = ...,
|
||||
@@ -906,28 +970,21 @@ def zip(iter1: Iterable[_T1], iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2,
|
||||
_T3, _T4]]: ...
|
||||
iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2, _T3, _T4]]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2,
|
||||
_T3, _T4, _T5]]: ...
|
||||
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any],
|
||||
iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any],
|
||||
*iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ...
|
||||
def __import__(name: unicode,
|
||||
globals: Dict[str, Any] = ...,
|
||||
locals: Dict[str, Any] = ...,
|
||||
def __import__(name: Text, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...,
|
||||
fromlist: List[str] = ..., level: int = ...) -> Any: ...
|
||||
|
||||
def globals() -> Dict[str, Any]: ...
|
||||
def locals() -> Dict[str, Any]: ...
|
||||
|
||||
# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
|
||||
# not exposed anywhere under that name, we make it private here.
|
||||
class ellipsis: ...
|
||||
Ellipsis = ... # type: ellipsis
|
||||
Ellipsis: ellipsis
|
||||
|
||||
# TODO: buffer support is incomplete; e.g. some_string.startswith(some_buffer) doesn't type check.
|
||||
_AnyBuffer = TypeVar('_AnyBuffer', str, unicode, bytearray, buffer)
|
||||
@@ -941,39 +998,9 @@ class buffer(Sized):
|
||||
def __len__(self) -> int: ...
|
||||
def __mul__(self, x: int) -> str: ...
|
||||
|
||||
class memoryview(Sized, Container[bytes]):
|
||||
format = ... # type: str
|
||||
itemsize = ... # type: int
|
||||
shape = ... # type: Optional[Tuple[int, ...]]
|
||||
strides = ... # type: Optional[Tuple[int, ...]]
|
||||
suboffsets = ... # type: Optional[Tuple[int, ...]]
|
||||
readonly = ... # type: bool
|
||||
ndim = ... # type: int
|
||||
|
||||
def __init__(self, obj: Union[str, bytearray, buffer, memoryview]) -> None: ...
|
||||
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> bytes: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> memoryview: ...
|
||||
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@overload
|
||||
def __setitem__(self, i: int, o: bytes) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: memoryview) -> None: ...
|
||||
|
||||
def tobytes(self) -> bytes: ...
|
||||
def tolist(self) -> List[int]: ...
|
||||
|
||||
class BaseException(object):
|
||||
args = ... # type: Tuple[Any, ...]
|
||||
message = ... # type: Any
|
||||
args: Tuple[Any, ...]
|
||||
message: Any
|
||||
def __init__(self, *args: object) -> None: ...
|
||||
def __getitem__(self, i: int) -> Any: ...
|
||||
def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ...
|
||||
@@ -981,66 +1008,76 @@ class BaseException(object):
|
||||
class GeneratorExit(BaseException): ...
|
||||
class KeyboardInterrupt(BaseException): ...
|
||||
class SystemExit(BaseException):
|
||||
code = 0
|
||||
code: int
|
||||
class Exception(BaseException): ...
|
||||
class StopIteration(Exception): ...
|
||||
class StopIteration(Exception):
|
||||
class StandardError(Exception): ...
|
||||
class ArithmeticError(StandardError): ...
|
||||
class BufferError(StandardError): ...
|
||||
_StandardError = StandardError
|
||||
class EnvironmentError(StandardError):
|
||||
errno = 0
|
||||
strerror = ... # type: str
|
||||
errno: int
|
||||
strerror: str
|
||||
# TODO can this be unicode?
|
||||
filename = ... # type: str
|
||||
class LookupError(StandardError): ...
|
||||
class RuntimeError(StandardError): ...
|
||||
class ValueError(StandardError): ...
|
||||
class AssertionError(StandardError): ...
|
||||
class AttributeError(StandardError): ...
|
||||
class EOFError(StandardError): ...
|
||||
class FloatingPointError(ArithmeticError): ...
|
||||
filename: str
|
||||
class OSError(EnvironmentError): ...
|
||||
class IOError(EnvironmentError): ...
|
||||
class ImportError(StandardError): ...
|
||||
|
||||
class ArithmeticError(_StandardError): ...
|
||||
class AssertionError(_StandardError): ...
|
||||
class AttributeError(_StandardError): ...
|
||||
class BufferError(_StandardError): ...
|
||||
class EOFError(_StandardError): ...
|
||||
class ImportError(_StandardError):
|
||||
class LookupError(_StandardError): ...
|
||||
class MemoryError(_StandardError): ...
|
||||
class NameError(_StandardError): ...
|
||||
class ReferenceError(_StandardError): ...
|
||||
class RuntimeError(_StandardError): ...
|
||||
class SyntaxError(_StandardError):
|
||||
msg: str
|
||||
lineno: int
|
||||
offset: Optional[int]
|
||||
text: str
|
||||
filename: str
|
||||
class SystemError(_StandardError): ...
|
||||
class TypeError(_StandardError): ...
|
||||
class ValueError(_StandardError): ...
|
||||
|
||||
class FloatingPointError(ArithmeticError): ...
|
||||
class OverflowError(ArithmeticError): ...
|
||||
class ZeroDivisionError(ArithmeticError): ...
|
||||
|
||||
|
||||
class IndexError(LookupError): ...
|
||||
class KeyError(LookupError): ...
|
||||
class MemoryError(StandardError): ...
|
||||
class NameError(StandardError): ...
|
||||
class NotImplementedError(RuntimeError): ...
|
||||
class OSError(EnvironmentError): ...
|
||||
|
||||
class UnboundLocalError(NameError): ...
|
||||
|
||||
class WindowsError(OSError):
|
||||
winerror = ... # type: int
|
||||
class OverflowError(ArithmeticError): ...
|
||||
class ReferenceError(StandardError): ...
|
||||
class SyntaxError(StandardError):
|
||||
msg = ... # type: str
|
||||
lineno = ... # type: int
|
||||
offset = ... # type: int
|
||||
text = ... # type: str
|
||||
filename = ... # type: str
|
||||
winerror: int
|
||||
|
||||
class NotImplementedError(RuntimeError): ...
|
||||
|
||||
class IndentationError(SyntaxError): ...
|
||||
class TabError(IndentationError): ...
|
||||
class SystemError(StandardError): ...
|
||||
class TypeError(StandardError): ...
|
||||
class UnboundLocalError(NameError): ...
|
||||
|
||||
class UnicodeError(ValueError): ...
|
||||
class UnicodeDecodeError(UnicodeError):
|
||||
encoding: bytes
|
||||
encoding: str
|
||||
object: bytes
|
||||
start: int
|
||||
end: int
|
||||
reason: bytes
|
||||
def __init__(self, __encoding: bytes, __object: bytes, __start: int, __end: int,
|
||||
__reason: bytes) -> None: ...
|
||||
reason: str
|
||||
def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int,
|
||||
__reason: str) -> None: ...
|
||||
class UnicodeEncodeError(UnicodeError):
|
||||
encoding: bytes
|
||||
object: unicode
|
||||
encoding: str
|
||||
object: Text
|
||||
start: int
|
||||
end: int
|
||||
reason: bytes
|
||||
def __init__(self, __encoding: bytes, __object: unicode, __start: int, __end: int,
|
||||
__reason: bytes) -> None: ...
|
||||
reason: str
|
||||
def __init__(self, __encoding: str, __object: Text, __start: int, __end: int,
|
||||
__reason: str) -> None: ...
|
||||
class UnicodeTranslateError(UnicodeError): ...
|
||||
class ZeroDivisionError(ArithmeticError): ...
|
||||
|
||||
class Warning(Exception): ...
|
||||
class UserWarning(Warning): ...
|
||||
@@ -1053,15 +1090,6 @@ class ImportWarning(Warning): ...
|
||||
class UnicodeWarning(Warning): ...
|
||||
class BytesWarning(Warning): ...
|
||||
|
||||
def eval(s: Union[str, unicode], globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> Any: ...
|
||||
def exec(object: str,
|
||||
globals: Optional[Dict[str, Any]] = ...,
|
||||
locals: Optional[Dict[str, Any]] = ...) -> Any: ... # TODO code object as source
|
||||
|
||||
def cmp(x: Any, y: Any) -> int: ...
|
||||
|
||||
def execfile(filename: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Dict[str, Any]] = ...) -> None: ...
|
||||
|
||||
class file(BinaryIO):
|
||||
@overload
|
||||
def __init__(self, file: str, mode: str = ..., buffering: int = ...) -> None: ...
|
||||
@@ -1089,8 +1117,3 @@ class file(BinaryIO):
|
||||
def write(self, data: str) -> int: ...
|
||||
def writelines(self, data: Iterable[str]) -> None: ...
|
||||
def truncate(self, pos: Optional[int] = ...) -> int: ...
|
||||
|
||||
# Very old builtins
|
||||
def apply(func: Callable[..., _T], args: Optional[Sequence[Any]] = ..., kwds: Optional[Mapping[str, Any]] = ...) -> _T: ...
|
||||
_N = TypeVar('_N', bool, int, float, complex)
|
||||
def coerce(x: _N, y: _N) -> Tuple[_N, _N]: ...
|
||||
|
||||
@@ -21,6 +21,7 @@ from typing import (
|
||||
ValuesView as ValuesView,
|
||||
)
|
||||
|
||||
_S = TypeVar('_S')
|
||||
_T = TypeVar('_T')
|
||||
_KT = TypeVar('_KT')
|
||||
_VT = TypeVar('_VT')
|
||||
@@ -53,6 +54,7 @@ class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
|
||||
def __setitem__(self, i: int, x: _T) -> None: ...
|
||||
def __contains__(self, o: _T) -> bool: ...
|
||||
def __reversed__(self) -> Iterator[_T]: ...
|
||||
def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ...
|
||||
|
||||
_CounterT = TypeVar('_CounterT', bound=Counter)
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ from _io import UnsupportedOperation as UnsupportedOperation
|
||||
from _io import open as open
|
||||
|
||||
def _OpenWrapper(file: Union[str, unicode, int],
|
||||
mode: unicode = ..., buffering: int = ..., encoding: unicode = ...,
|
||||
errors: unicode = ..., newline: unicode = ...,
|
||||
closefd: bool = ...) -> IO[Any]: ...
|
||||
mode: unicode = ..., buffering: int = ..., encoding: unicode = ...,
|
||||
errors: unicode = ..., newline: unicode = ...,
|
||||
closefd: bool = ...) -> IO[Any]: ...
|
||||
|
||||
SEEK_SET = ... # type: int
|
||||
SEEK_CUR = ... # type: int
|
||||
|
||||
@@ -32,10 +32,9 @@ def ifilterfalse(predicate: Optional[Callable[[_T], Any]],
|
||||
iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
|
||||
@overload
|
||||
def groupby(iterable: Iterable[_T]) -> Iterator[Tuple[_T, Iterator[_T]]]: ...
|
||||
def groupby(iterable: Iterable[_T], key: None = ...) -> Iterator[Tuple[_T, Iterator[_T]]]: ...
|
||||
@overload
|
||||
def groupby(iterable: Iterable[_T],
|
||||
key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ...
|
||||
def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ...
|
||||
|
||||
@overload
|
||||
def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ...
|
||||
@@ -54,8 +53,8 @@ _T6 = TypeVar('_T6')
|
||||
def imap(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ...
|
||||
@overload
|
||||
def imap(func: Callable[[_T1, _T2], _S],
|
||||
iter1: Iterable[_T1],
|
||||
iter2: Iterable[_T2]) -> Iterator[_S]: ...
|
||||
iter1: Iterable[_T1],
|
||||
iter2: Iterable[_T2]) -> Iterator[_S]: ...
|
||||
@overload
|
||||
def imap(func: Callable[[_T1, _T2, _T3], _S],
|
||||
iter1: Iterable[_T1], iter2: Iterable[_T2],
|
||||
|
||||
@@ -26,19 +26,19 @@ class Queue(_BaseQueue[_T]):
|
||||
def cancel_join_thread(self) -> None: ...
|
||||
|
||||
def Manager(): ...
|
||||
def Pipe(duplex=True): ...
|
||||
def Pipe(duplex: bool = ...): ...
|
||||
def cpu_count() -> int: ...
|
||||
def freeze_support(): ...
|
||||
def get_logger(): ...
|
||||
def log_to_stderr(level=None): ...
|
||||
def log_to_stderr(level: Optional[Any] = ...): ...
|
||||
def allow_connection_pickling(): ...
|
||||
def Lock(): ...
|
||||
def RLock(): ...
|
||||
def Condition(lock=None): ...
|
||||
def Semaphore(value=1): ...
|
||||
def BoundedSemaphore(value=1): ...
|
||||
def Condition(lock: Optional[Any] = ...): ...
|
||||
def Semaphore(value: int = ...): ...
|
||||
def BoundedSemaphore(value: int = ...): ...
|
||||
def Event(): ...
|
||||
def JoinableQueue(maxsize=0): ...
|
||||
def JoinableQueue(maxsize: int = ...): ...
|
||||
def RawValue(typecode_or_type, *args): ...
|
||||
def RawArray(typecode_or_type, size_or_initializer): ...
|
||||
def Value(typecode_or_type, *args, **kwds): ...
|
||||
|
||||
@@ -15,6 +15,8 @@ class IMapIterator(Iterable[Any]):
|
||||
def __iter__(self) -> Iterator[Any]: ...
|
||||
def next(self, timeout: Optional[float] = ...) -> Any: ...
|
||||
|
||||
class IMapUnorderedIterator(IMapIterator): ...
|
||||
|
||||
class Pool(ContextManager[Pool]):
|
||||
def __init__(self, processes: Optional[int] = ...,
|
||||
initializer: Optional[Callable[..., None]] = ...,
|
||||
@@ -25,10 +27,10 @@ class Pool(ContextManager[Pool]):
|
||||
args: Iterable[Any] = ...,
|
||||
kwds: Dict[str, Any] = ...) -> Any: ...
|
||||
def apply_async(self,
|
||||
func: Callable[..., Any],
|
||||
args: Iterable[Any] = ...,
|
||||
kwds: Dict[str, Any] = ...,
|
||||
callback: Optional[Callable[..., None]] = ...) -> AsyncResult: ...
|
||||
func: Callable[..., Any],
|
||||
args: Iterable[Any] = ...,
|
||||
kwds: Dict[str, Any] = ...,
|
||||
callback: Optional[Callable[..., None]] = ...) -> AsyncResult: ...
|
||||
def map(self,
|
||||
func: Callable[..., Any],
|
||||
iterable: Iterable[Any] = ...,
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
from typing import Any
|
||||
from typing import Any, Optional
|
||||
|
||||
def current_process(): ...
|
||||
def active_children(): ...
|
||||
|
||||
class Process:
|
||||
def __init__(self, group=None, target=None, name=None, args=..., kwargs=...): ...
|
||||
def __init__(self, group: Optional[Any] = ..., target: Optional[Any] = ..., name: Optional[Any] = ..., args=...,
|
||||
kwargs=...): ...
|
||||
def run(self): ...
|
||||
def start(self): ...
|
||||
def terminate(self): ...
|
||||
def join(self, timeout=None): ...
|
||||
def join(self, timeout: Optional[Any] = ...): ...
|
||||
def is_alive(self): ...
|
||||
@property
|
||||
def name(self): ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any
|
||||
from typing import Any, Optional
|
||||
import threading
|
||||
|
||||
SUBDEBUG = ... # type: Any
|
||||
@@ -9,13 +9,13 @@ def debug(msg, *args): ...
|
||||
def info(msg, *args): ...
|
||||
def sub_warning(msg, *args): ...
|
||||
def get_logger(): ...
|
||||
def log_to_stderr(level=None): ...
|
||||
def log_to_stderr(level: Optional[Any] = ...): ...
|
||||
def get_temp_dir(): ...
|
||||
def register_after_fork(obj, func): ...
|
||||
|
||||
class Finalize:
|
||||
def __init__(self, obj, callback, args=..., kwargs=None, exitpriority=None): ...
|
||||
def __call__(self, wr=None): ...
|
||||
def __init__(self, obj, callback, args=..., kwargs: Optional[Any] = ..., exitpriority: Optional[Any] = ...): ...
|
||||
def __call__(self, wr: Optional[Any] = ...): ...
|
||||
def cancel(self): ...
|
||||
def still_active(self): ...
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class CodeType:
|
||||
co_cellvars = ... # type: Tuple[str, ...]
|
||||
co_code = ... # type: str
|
||||
co_consts = ... # type: Tuple[Any, ...]
|
||||
co_filename = ... # type: Optional[str]
|
||||
co_filename = ... # type: str
|
||||
co_firstlineno = ... # type: int
|
||||
co_flags = ... # type: int
|
||||
co_freevars = ... # type: Tuple[str, ...]
|
||||
@@ -88,10 +88,7 @@ class UnboundMethodType:
|
||||
def __init__(self, func: Callable, obj: object) -> None: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
class InstanceType:
|
||||
__doc__ = ... # type: Optional[str]
|
||||
__class__ = ... # type: type
|
||||
__module__ = ... # type: Any
|
||||
class InstanceType(object): ...
|
||||
|
||||
MethodType = UnboundMethodType
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ class Container(Protocol[_T_co]):
|
||||
@abstractmethod
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
|
||||
class Sequence(Iterable[_T_co], Container[_T_co], Sized, Reversible[_T_co], Generic[_T_co]):
|
||||
class Sequence(Iterable[_T_co], Container[_T_co], Reversible[_T_co], Generic[_T_co]):
|
||||
@overload
|
||||
@abstractmethod
|
||||
def __getitem__(self, i: int) -> _T_co: ...
|
||||
@@ -157,6 +157,9 @@ class Sequence(Iterable[_T_co], Container[_T_co], Sized, Reversible[_T_co], Gene
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_T_co]: ...
|
||||
def __reversed__(self) -> Iterator[_T_co]: ...
|
||||
# Implement Sized (but don't have it as a base class).
|
||||
@abstractmethod
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class MutableSequence(Sequence[_T], Generic[_T]):
|
||||
@abstractmethod
|
||||
@@ -187,7 +190,7 @@ class MutableSequence(Sequence[_T], Generic[_T]):
|
||||
def remove(self, object: _T) -> None: ...
|
||||
def __iadd__(self, x: Iterable[_T]) -> MutableSequence[_T]: ...
|
||||
|
||||
class AbstractSet(Sized, Iterable[_T_co], Container[_T_co], Generic[_T_co]):
|
||||
class AbstractSet(Iterable[_T_co], Container[_T_co], Generic[_T_co]):
|
||||
@abstractmethod
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
# Mixin methods
|
||||
@@ -201,6 +204,10 @@ class AbstractSet(Sized, Iterable[_T_co], Container[_T_co], Generic[_T_co]):
|
||||
def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...
|
||||
# TODO: argument can be any container?
|
||||
def isdisjoint(self, s: AbstractSet[Any]) -> bool: ...
|
||||
# Implement Sized (but don't have it as a base class).
|
||||
@abstractmethod
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
|
||||
class MutableSet(AbstractSet[_T], Generic[_T]):
|
||||
@abstractmethod
|
||||
@@ -216,14 +223,14 @@ class MutableSet(AbstractSet[_T], Generic[_T]):
|
||||
def __ixor__(self, s: AbstractSet[_S]) -> MutableSet[Union[_T, _S]]: ...
|
||||
def __isub__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ...
|
||||
|
||||
class MappingView(Sized):
|
||||
class MappingView(object):
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class ItemsView(AbstractSet[Tuple[_KT_co, _VT_co]], MappingView, Generic[_KT_co, _VT_co]):
|
||||
class ItemsView(MappingView, AbstractSet[Tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]):
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ...
|
||||
|
||||
class KeysView(AbstractSet[_KT_co], MappingView, Generic[_KT_co]):
|
||||
class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]):
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_KT_co]: ...
|
||||
|
||||
@@ -238,7 +245,7 @@ class ContextManager(Protocol[_T_co]):
|
||||
exc_value: Optional[BaseException],
|
||||
traceback: Optional[TracebackType]) -> Optional[bool]: ...
|
||||
|
||||
class Mapping(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT_co]):
|
||||
class Mapping(Iterable[_KT], Container[_KT], Generic[_KT, _VT_co]):
|
||||
# TODO: We wish the key type could also be covariant, but that doesn't work,
|
||||
# see discussion in https: //github.com/python/typing/pull/273.
|
||||
@abstractmethod
|
||||
@@ -256,6 +263,9 @@ class Mapping(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT_co]):
|
||||
def itervalues(self) -> Iterator[_VT_co]: ...
|
||||
def iteritems(self) -> Iterator[Tuple[_KT, _VT_co]]: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
# Implement Sized (but don't have it as a base class).
|
||||
@abstractmethod
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
@abstractmethod
|
||||
@@ -447,7 +457,7 @@ def cast(tp: str, obj: Any) -> Any: ...
|
||||
class NamedTuple(tuple):
|
||||
_fields = ... # type: Tuple[str, ...]
|
||||
|
||||
def __init__(self, typename: str, fields: Iterable[Tuple[str, Any]] = ..., *,
|
||||
def __init__(self, typename: Text, fields: Iterable[Tuple[Text, Any]] = ..., *,
|
||||
verbose: bool = ..., rename: bool = ..., **kwargs: Any) -> None: ...
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -41,10 +41,8 @@ class TestResult:
|
||||
def stopTest(self, test: Testable) -> None: ...
|
||||
def startTestRun(self) -> None: ...
|
||||
def stopTestRun(self) -> None: ...
|
||||
def addError(self, test: Testable,
|
||||
err: Tuple[type, Any, Any]) -> None: ... # TODO
|
||||
def addFailure(self, test: Testable,
|
||||
err: Tuple[type, Any, Any]) -> None: ... # TODO
|
||||
def addError(self, test: Testable, err: Tuple[type, Any, Any]) -> None: ... # TODO
|
||||
def addFailure(self, test: Testable, err: Tuple[type, Any, Any]) -> None: ... # TODO
|
||||
def addSuccess(self, test: Testable) -> None: ...
|
||||
def addSkip(self, test: Testable, reason: str) -> None: ...
|
||||
def addExpectedFailure(self, test: Testable, err: str) -> None: ...
|
||||
@@ -201,7 +199,7 @@ class TestLoader:
|
||||
def loadTestsFromName(self, name: str = ...,
|
||||
module: Optional[types.ModuleType] = ...) -> TestSuite: ...
|
||||
def loadTestsFromNames(self, names: List[str] = ...,
|
||||
module: Optional[types.ModuleType] = ...) -> TestSuite: ...
|
||||
module: Optional[types.ModuleType] = ...) -> TestSuite: ...
|
||||
def discover(self, start_dir: str, pattern: str = ...,
|
||||
top_level_dir: Optional[str] = ...) -> TestSuite: ...
|
||||
def getTestCaseNames(self, testCaseClass: Type[TestCase] = ...) -> List[str]: ...
|
||||
|
||||
@@ -8,6 +8,7 @@ import sys
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_ActionT = TypeVar('_ActionT', bound='Action')
|
||||
_N = TypeVar('_N')
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
_Text = str
|
||||
@@ -61,7 +62,7 @@ class _ActionsContainer:
|
||||
choices: Iterable[_T] = ...,
|
||||
required: bool = ...,
|
||||
help: Optional[_Text] = ...,
|
||||
metavar: Union[_Text, Tuple[_Text, ...]] = ...,
|
||||
metavar: Optional[Union[_Text, Tuple[_Text, ...]]] = ...,
|
||||
dest: Optional[_Text] = ...,
|
||||
version: _Text = ...,
|
||||
**kwargs: Any) -> Action: ...
|
||||
@@ -121,8 +122,19 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
argument_default: Optional[_Text] = ...,
|
||||
conflict_handler: _Text = ...,
|
||||
add_help: bool = ...) -> None: ...
|
||||
def parse_args(self, args: Optional[Sequence[_Text]] = ...,
|
||||
namespace: Optional[Namespace] = ...) -> Namespace: ...
|
||||
|
||||
# The type-ignores in these overloads should be temporary. See:
|
||||
# https://github.com/python/typeshed/pull/2643#issuecomment-442280277
|
||||
@overload
|
||||
def parse_args(self, args: Optional[Sequence[_Text]] = ...) -> Namespace: ...
|
||||
@overload
|
||||
def parse_args(self, args: Optional[Sequence[_Text]], namespace: None) -> Namespace: ... # type: ignore
|
||||
@overload
|
||||
def parse_args(self, args: Optional[Sequence[_Text]], namespace: _N) -> _N: ...
|
||||
@overload
|
||||
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore
|
||||
@overload
|
||||
def parse_args(self, *, namespace: _N) -> _N: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def add_subparsers(self, title: _Text = ...,
|
||||
@@ -236,7 +248,7 @@ class Action(_AttributeHolder):
|
||||
choices: Optional[Iterable[Any]]
|
||||
required: bool
|
||||
help: Optional[_Text]
|
||||
metavar: Union[_Text, Tuple[_Text, ...]]
|
||||
metavar: Optional[Union[_Text, Tuple[_Text, ...]]]
|
||||
|
||||
def __init__(self,
|
||||
option_strings: Sequence[_Text],
|
||||
@@ -371,6 +383,7 @@ class _SubParsersAction(Action):
|
||||
_prog_prefix: _Text
|
||||
_parser_class: Type[ArgumentParser]
|
||||
_name_parser_map: Dict[_Text, ArgumentParser]
|
||||
choices: Dict[_Text, ArgumentParser]
|
||||
_choices_actions: List[Action]
|
||||
def __init__(self,
|
||||
option_strings: Sequence[_Text],
|
||||
|
||||
@@ -274,16 +274,16 @@ class datetime(date):
|
||||
def strptime(cls, date_string: _Text, format: _Text) -> datetime: ...
|
||||
def utcoffset(self) -> Optional[timedelta]: ...
|
||||
def tzname(self) -> Optional[str]: ...
|
||||
def dst(self) -> Optional[int]: ...
|
||||
def dst(self) -> Optional[timedelta]: ...
|
||||
def __le__(self, other: datetime) -> bool: ... # type: ignore
|
||||
def __lt__(self, other: datetime) -> bool: ... # type: ignore
|
||||
def __ge__(self, other: datetime) -> bool: ... # type: ignore
|
||||
def __gt__(self, other: datetime) -> bool: ... # type: ignore
|
||||
def __add__(self, other: timedelta) -> datetime: ...
|
||||
@overload # type: ignore
|
||||
def __sub__(self, other: datetime) -> timedelta: ... # type: ignore
|
||||
@overload # type: ignore
|
||||
def __sub__(self, other: timedelta) -> datetime: ... # type: ignore
|
||||
def __sub__(self, other: datetime) -> timedelta: ...
|
||||
@overload
|
||||
def __sub__(self, other: timedelta) -> datetime: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def weekday(self) -> int: ...
|
||||
def isoweekday(self) -> int: ...
|
||||
|
||||
@@ -497,6 +497,9 @@ class timeout(error):
|
||||
# Addresses can be either tuples of varying lengths (AF_INET, AF_INET6,
|
||||
# AF_NETLINK, AF_TIPC) or strings (AF_UNIX).
|
||||
|
||||
_Address = Union[tuple, str]
|
||||
_RetAddress = Any
|
||||
|
||||
# TODO AF_PACKET and AF_BLUETOOTH address objects
|
||||
|
||||
_CMSG = Tuple[int, int, bytes]
|
||||
@@ -509,39 +512,38 @@ class socket:
|
||||
proto: int
|
||||
|
||||
if sys.version_info < (3,):
|
||||
def __init__(self, family: int = ..., type: int = ...,
|
||||
proto: int = ...) -> None: ...
|
||||
def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, family: int = ..., type: int = ...,
|
||||
proto: int = ..., fileno: Optional[int] = ...) -> None: ...
|
||||
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: Optional[int] = ...) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 2):
|
||||
def __enter__(self: _SelfT) -> _SelfT: ...
|
||||
def __exit__(self, *args: Any) -> None: ...
|
||||
|
||||
# --- methods ---
|
||||
# second tuple item is an address
|
||||
def accept(self) -> Tuple[socket, Any]: ...
|
||||
def bind(self, address: Union[tuple, str, bytes]) -> None: ...
|
||||
def accept(self) -> Tuple[socket, _RetAddress]: ...
|
||||
def bind(self, address: Union[_Address, bytes]) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def connect(self, address: Union[tuple, str, bytes]) -> None: ...
|
||||
def connect_ex(self, address: Union[tuple, str, bytes]) -> int: ...
|
||||
def connect(self, address: Union[_Address, bytes]) -> None: ...
|
||||
def connect_ex(self, address: Union[_Address, bytes]) -> int: ...
|
||||
def detach(self) -> int: ...
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
# return value is an address
|
||||
def getpeername(self) -> Any: ...
|
||||
def getsockname(self) -> Any: ...
|
||||
def getpeername(self) -> _RetAddress: ...
|
||||
def getsockname(self) -> _RetAddress: ...
|
||||
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: int) -> int: ...
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
|
||||
|
||||
def gettimeout(self) -> float: ...
|
||||
def gettimeout(self) -> Optional[float]: ...
|
||||
def ioctl(self, control: object,
|
||||
option: Tuple[int, int, int]) -> None: ...
|
||||
def listen(self, backlog: int) -> None: ...
|
||||
if sys.version_info < (3, 5):
|
||||
def listen(self, backlog: int) -> None: ...
|
||||
else:
|
||||
def listen(self, backlog: int = ...) -> None: ...
|
||||
# TODO the return value may be BinaryIO or TextIO, depending on mode
|
||||
def makefile(self, mode: str = ..., buffering: int = ...,
|
||||
encoding: str = ..., errors: str = ...,
|
||||
@@ -549,19 +551,18 @@ class socket:
|
||||
...
|
||||
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
|
||||
|
||||
# Any in return type is an address
|
||||
def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, Any]: ...
|
||||
def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, _RetAddress]: ...
|
||||
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int,
|
||||
flags: int = ...) -> Tuple[int, Any]: ...
|
||||
flags: int = ...) -> Tuple[int, _RetAddress]: ...
|
||||
def recv_into(self, buffer: _WriteBuffer, nbytes: int,
|
||||
flags: int = ...) -> int: ...
|
||||
def send(self, data: bytes, flags: int = ...) -> int: ...
|
||||
def sendall(self, data: bytes, flags: int =...) -> None:
|
||||
def sendall(self, data: bytes, flags: int = ...) -> None:
|
||||
... # return type: None on success
|
||||
@overload
|
||||
def sendto(self, data: bytes, address: Union[tuple, str]) -> int: ...
|
||||
def sendto(self, data: bytes, address: _Address) -> int: ...
|
||||
@overload
|
||||
def sendto(self, data: bytes, flags: int, address: Union[tuple, str]) -> int: ...
|
||||
def sendto(self, data: bytes, flags: int, address: _Address) -> int: ...
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
def settimeout(self, value: Optional[float]) -> None: ...
|
||||
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
|
||||
@@ -573,12 +574,12 @@ class socket:
|
||||
def recvmsg_into(self, __buffers: Iterable[_WriteBuffer], __ancbufsize: int = ...,
|
||||
__flags: int = ...) -> Tuple[int, List[_CMSG], int, Any]: ...
|
||||
def sendmsg(self, __buffers: Iterable[bytes], __ancdata: Iterable[_CMSG] = ...,
|
||||
__flags: int = ..., __address: Any = ...) -> int: ...
|
||||
__flags: int = ..., __address: _Address = ...) -> int: ...
|
||||
|
||||
|
||||
# ----- functions -----
|
||||
def create_connection(address: Tuple[Optional[str], int],
|
||||
timeout: float = ...,
|
||||
timeout: Optional[float] = ...,
|
||||
source_address: Tuple[Union[bytearray, bytes, Text], int] = ...) -> socket: ...
|
||||
|
||||
# the 5th tuple item is an address
|
||||
|
||||
@@ -144,6 +144,10 @@ class Connection(object):
|
||||
# set_progress_handler(handler, n) -> see https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.set_progress_handler
|
||||
def set_progress_handler(self, *args, **kwargs) -> None: ...
|
||||
def set_trace_callback(self, *args, **kwargs): ...
|
||||
# enable_load_extension and load_extension is not available on python distributions compiled
|
||||
# without sqlite3 loadable extension support. see footnotes https://docs.python.org/3/library/sqlite3.html#f1
|
||||
def enable_load_extension(self, enabled: bool) -> None: ...
|
||||
def load_extension(self, path: str) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def backup(self, target: Connection, *, pages: int = ...,
|
||||
progress: Optional[Callable[[int, int, int], object]] = ..., name: str = ...,
|
||||
|
||||
@@ -27,7 +27,15 @@ class SSLWantReadError(SSLError): ...
|
||||
class SSLWantWriteError(SSLError): ...
|
||||
class SSLSyscallError(SSLError): ...
|
||||
class SSLEOFError(SSLError): ...
|
||||
class CertificateError(Exception): ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
class SSLCertVerificationError(SSLError, ValueError):
|
||||
verify_code: int
|
||||
verify_message: str
|
||||
|
||||
CertificateError = SSLCertVerificationError
|
||||
else:
|
||||
class CertificateError(ValueError): ...
|
||||
|
||||
|
||||
def wrap_socket(sock: socket.socket, keyfile: Optional[str] = ...,
|
||||
@@ -165,9 +173,7 @@ if sys.version_info < (3,) or sys.version_info >= (3, 4):
|
||||
ALERT_DESCRIPTION_USER_CANCELLED: int
|
||||
|
||||
if sys.version_info < (3,) or sys.version_info >= (3, 4):
|
||||
_PurposeType = NamedTuple('_PurposeType',
|
||||
[('nid', int), ('shortname', str),
|
||||
('longname', str), ('oid', str)])
|
||||
_PurposeType = NamedTuple('_PurposeType', [('nid', int), ('shortname', str), ('longname', str), ('oid', str)])
|
||||
class Purpose:
|
||||
SERVER_AUTH: _PurposeType
|
||||
CLIENT_AUTH: _PurposeType
|
||||
|
||||
@@ -19,8 +19,7 @@ if sys.version_info < (3,):
|
||||
def activeCount() -> int: ...
|
||||
|
||||
def current_thread() -> Thread: ...
|
||||
if sys.version_info < (3,):
|
||||
def currentThread() -> Thread: ...
|
||||
def currentThread() -> Thread: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
def get_ident() -> int: ...
|
||||
@@ -69,8 +68,7 @@ class Thread:
|
||||
def getName(self) -> str: ...
|
||||
def setName(self, name: str) -> None: ...
|
||||
def is_alive(self) -> bool: ...
|
||||
if sys.version_info < (3,):
|
||||
def isAlive(self) -> bool: ...
|
||||
def isAlive(self) -> bool: ...
|
||||
def isDaemon(self) -> bool: ...
|
||||
def setDaemon(self, daemonic: bool) -> None: ...
|
||||
|
||||
|
||||
@@ -4,17 +4,22 @@
|
||||
# - ModuleType in types
|
||||
# - Loader in importlib.abc
|
||||
# - ModuleSpec in importlib.machinery (3.4 and later only)
|
||||
#
|
||||
# _Loader is the PEP-451-defined interface for a loader type/object.
|
||||
|
||||
from abc import ABCMeta
|
||||
import sys
|
||||
from typing import Any, Dict, List, Optional
|
||||
from typing import Any, Dict, List, Optional, Protocol
|
||||
|
||||
class _Loader(Protocol):
|
||||
def load_module(self, fullname: str) -> ModuleType: ...
|
||||
|
||||
class ModuleSpec:
|
||||
def __init__(self, name: str, loader: Optional[Loader], *,
|
||||
origin: Optional[str] = ..., loader_state: Any = ...,
|
||||
is_package: Optional[bool] = ...) -> None: ...
|
||||
name = ... # type: str
|
||||
loader = ... # type: Optional[Loader]
|
||||
loader = ... # type: Optional[_Loader]
|
||||
origin = ... # type: Optional[str]
|
||||
submodule_search_locations = ... # type: Optional[List[str]]
|
||||
loader_state = ... # type: Any
|
||||
@@ -26,7 +31,7 @@ class ModuleType:
|
||||
__name__ = ... # type: str
|
||||
__file__ = ... # type: str
|
||||
__dict__ = ... # type: Dict[str, Any]
|
||||
__loader__ = ... # type: Optional[Loader]
|
||||
__loader__ = ... # type: Optional[_Loader]
|
||||
__package__ = ... # type: Optional[str]
|
||||
__spec__ = ... # type: Optional[ModuleSpec]
|
||||
def __init__(self, name: str, doc: Optional[str] = ...) -> None: ...
|
||||
|
||||
@@ -22,8 +22,7 @@ _TransProtPair = Tuple[BaseTransport, BaseProtocol]
|
||||
class Handle:
|
||||
_cancelled = False
|
||||
_args = ... # type: List[Any]
|
||||
def __init__(self, callback: Callable[..., Any], args: List[Any],
|
||||
loop: AbstractEventLoop) -> None: ...
|
||||
def __init__(self, callback: Callable[..., Any], args: List[Any], loop: AbstractEventLoop) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def cancel(self) -> None: ...
|
||||
def _run(self) -> None: ...
|
||||
@@ -68,9 +67,9 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
|
||||
@abstractmethod
|
||||
def call_later(self, delay: float, callback: Callable[..., Any], *args: Any) -> Handle: ...
|
||||
def call_later(self, delay: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ...
|
||||
@abstractmethod
|
||||
def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> Handle: ...
|
||||
def call_at(self, when: float, callback: Callable[..., Any], *args: Any) -> TimerHandle: ...
|
||||
@abstractmethod
|
||||
def time(self) -> float: ...
|
||||
# Future methods
|
||||
@@ -90,7 +89,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
@coroutine
|
||||
def run_in_executor(self, executor: Any,
|
||||
func: Callable[..., _T], *args: Any) -> Generator[Any, None, _T]: ...
|
||||
func: Callable[..., _T], *args: Any) -> Generator[Any, None, _T]: ...
|
||||
@abstractmethod
|
||||
def set_default_executor(self, executor: Any) -> None: ...
|
||||
# Network I/O methods returning Futures.
|
||||
@@ -99,20 +98,37 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
# TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers
|
||||
# https://github.com/python/mypy/issues/2509
|
||||
def getaddrinfo(self, host: Optional[str], port: Union[str, int, None], *,
|
||||
family: int = ..., type: int = ..., proto: int = ..., flags: int = ...) -> Generator[Any, None, List[Tuple[int, int, int, str, Tuple[Any, ...]]]]: ...
|
||||
family: int = ..., type: int = ..., proto: int = ...,
|
||||
flags: int = ...) -> Generator[Any, None, List[Tuple[int, int, int, str, Tuple[Any, ...]]]]: ...
|
||||
@abstractmethod
|
||||
@coroutine
|
||||
def getnameinfo(self, sockaddr: tuple, flags: int = ...) -> Generator[Any, None, Tuple[str, int]]: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
@coroutine
|
||||
def create_connection(self, protocol_factory: _ProtocolFactory, host: str = ..., port: int = ..., *,
|
||||
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: Optional[socket] = ...,
|
||||
local_addr: str = ..., server_hostname: str = ...) -> Generator[Any, None, _TransProtPair]: ...
|
||||
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: None = ...,
|
||||
local_addr: Optional[str] = ..., server_hostname: Optional[str] = ...) -> Generator[Any, None, _TransProtPair]: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
@coroutine
|
||||
def create_server(self, protocol_factory: _ProtocolFactory, host: Union[str, Sequence[str]] = ..., port: int = ..., *,
|
||||
def create_connection(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *,
|
||||
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: socket,
|
||||
local_addr: None = ..., server_hostname: Optional[str] = ...) -> Generator[Any, None, _TransProtPair]: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
@coroutine
|
||||
def create_server(self, protocol_factory: _ProtocolFactory, host: Optional[Union[str, Sequence[str]]] = ..., port: int = ..., *,
|
||||
family: int = ..., flags: int = ...,
|
||||
sock: Optional[socket] = ..., backlog: int = ..., ssl: _SSLContext = ...,
|
||||
sock: None = ..., backlog: int = ..., ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...) -> Generator[Any, None, AbstractServer]: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
@coroutine
|
||||
def create_server(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *,
|
||||
family: int = ..., flags: int = ...,
|
||||
sock: socket, backlog: int = ..., ssl: _SSLContext = ...,
|
||||
reuse_address: Optional[bool] = ...,
|
||||
reuse_port: Optional[bool] = ...) -> Generator[Any, None, AbstractServer]: ...
|
||||
@abstractmethod
|
||||
@@ -198,7 +214,7 @@ class AbstractEventLoopPolicy(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def get_event_loop(self) -> AbstractEventLoop: ...
|
||||
@abstractmethod
|
||||
def set_event_loop(self, loop: AbstractEventLoop) -> None: ...
|
||||
def set_event_loop(self, loop: Optional[AbstractEventLoop]) -> None: ...
|
||||
@abstractmethod
|
||||
def new_event_loop(self) -> AbstractEventLoop: ...
|
||||
# Child processes handling (Unix only).
|
||||
@@ -210,14 +226,14 @@ class AbstractEventLoopPolicy(metaclass=ABCMeta):
|
||||
class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy, metaclass=ABCMeta):
|
||||
def __init__(self) -> None: ...
|
||||
def get_event_loop(self) -> AbstractEventLoop: ...
|
||||
def set_event_loop(self, loop: AbstractEventLoop) -> None: ...
|
||||
def set_event_loop(self, loop: Optional[AbstractEventLoop]) -> None: ...
|
||||
def new_event_loop(self) -> AbstractEventLoop: ...
|
||||
|
||||
def get_event_loop_policy() -> AbstractEventLoopPolicy: ...
|
||||
def set_event_loop_policy(policy: AbstractEventLoopPolicy) -> None: ...
|
||||
|
||||
def get_event_loop() -> AbstractEventLoop: ...
|
||||
def set_event_loop(loop: AbstractEventLoop) -> None: ...
|
||||
def set_event_loop(loop: Optional[AbstractEventLoop]) -> None: ...
|
||||
def new_event_loop() -> AbstractEventLoop: ...
|
||||
|
||||
def get_child_watcher() -> Any: ... # TODO: unix_events.AbstractChildWatcher
|
||||
|
||||
@@ -35,6 +35,8 @@ class Future(Awaitable[_T], Iterable[_T]):
|
||||
def __init__(self, *, loop: AbstractEventLoop = ...) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __del__(self) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def get_loop(self) -> AbstractEventLoop: ...
|
||||
def cancel(self) -> bool: ...
|
||||
def _schedule_callbacks(self) -> None: ...
|
||||
def cancelled(self) -> bool: ...
|
||||
|
||||
@@ -64,9 +64,9 @@ class FlowControlMixin(protocols.Protocol): ...
|
||||
|
||||
class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
|
||||
def __init__(self,
|
||||
stream_reader: StreamReader,
|
||||
client_connected_cb: _ClientConnectedCallback = ...,
|
||||
loop: Optional[events.AbstractEventLoop] = ...) -> None: ...
|
||||
stream_reader: StreamReader,
|
||||
client_connected_cb: _ClientConnectedCallback = ...,
|
||||
loop: Optional[events.AbstractEventLoop] = ...) -> None: ...
|
||||
def connection_made(self, transport: transports.BaseTransport) -> None: ...
|
||||
def connection_lost(self, exc: Optional[Exception]) -> None: ...
|
||||
def data_received(self, data: bytes) -> None: ...
|
||||
@@ -74,10 +74,10 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
|
||||
|
||||
class StreamWriter:
|
||||
def __init__(self,
|
||||
transport: transports.BaseTransport,
|
||||
protocol: protocols.BaseProtocol,
|
||||
reader: StreamReader,
|
||||
loop: events.AbstractEventLoop) -> None: ...
|
||||
transport: transports.BaseTransport,
|
||||
protocol: protocols.BaseProtocol,
|
||||
reader: Optional[StreamReader],
|
||||
loop: events.AbstractEventLoop) -> None: ...
|
||||
@property
|
||||
def transport(self) -> transports.BaseTransport: ...
|
||||
def write(self, data: bytes) -> None: ...
|
||||
@@ -91,8 +91,8 @@ class StreamWriter:
|
||||
|
||||
class StreamReader:
|
||||
def __init__(self,
|
||||
limit: int = ...,
|
||||
loop: Optional[events.AbstractEventLoop] = ...) -> None: ...
|
||||
limit: int = ...,
|
||||
loop: Optional[events.AbstractEventLoop] = ...) -> None: ...
|
||||
def exception(self) -> Exception: ...
|
||||
def set_exception(self, exc: Exception) -> None: ...
|
||||
def set_transport(self, transport: transports.BaseTransport) -> None: ...
|
||||
|
||||
@@ -29,9 +29,9 @@ class Process:
|
||||
stderr = ... # type: Optional[streams.StreamReader]
|
||||
pid = ... # type: int
|
||||
def __init__(self,
|
||||
transport: transports.BaseTransport,
|
||||
protocol: protocols.BaseProtocol,
|
||||
loop: events.AbstractEventLoop) -> None: ...
|
||||
transport: transports.BaseTransport,
|
||||
protocol: protocols.BaseProtocol,
|
||||
loop: events.AbstractEventLoop) -> None: ...
|
||||
@property
|
||||
def returncode(self) -> int: ...
|
||||
@coroutine
|
||||
|
||||
@@ -22,9 +22,9 @@ FIRST_COMPLETED: str
|
||||
ALL_COMPLETED: str
|
||||
|
||||
def as_completed(fs: Sequence[_FutureT[_T]], *, loop: AbstractEventLoop = ...,
|
||||
timeout: Optional[float] = ...) -> Iterator[Generator[Any, None, _T]]: ...
|
||||
timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ...
|
||||
def ensure_future(coro_or_future: _FutureT[_T],
|
||||
*, loop: AbstractEventLoop = ...) -> Future[_T]: ...
|
||||
*, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
|
||||
# Prior to Python 3.7 'async' was an alias for 'ensure_future'.
|
||||
# It became a keyword in 3.7.
|
||||
@overload
|
||||
@@ -53,17 +53,16 @@ def run_coroutine_threadsafe(coro: _FutureT[_T],
|
||||
loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ...
|
||||
def shield(arg: _FutureT[_T], *, loop: AbstractEventLoop = ...) -> Future[_T]: ...
|
||||
def sleep(delay: float, result: _T = ..., loop: AbstractEventLoop = ...) -> Future[_T]: ...
|
||||
def wait(fs: Iterable[_FutureT[_T]], *, loop: AbstractEventLoop = ...,
|
||||
timeout: Optional[float] = ...,
|
||||
def wait(fs: Iterable[_FutureT[_T]], *, loop: AbstractEventLoop = ..., timeout: Optional[float] = ...,
|
||||
return_when: str = ...) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ...
|
||||
def wait_for(fut: _FutureT[_T], timeout: Optional[float],
|
||||
*, loop: AbstractEventLoop = ...) -> Future[_T]: ...
|
||||
|
||||
class Task(Future[_T], Generic[_T]):
|
||||
@classmethod
|
||||
def current_task(cls, loop: AbstractEventLoop = ...) -> Task: ...
|
||||
def current_task(cls, loop: Optional[AbstractEventLoop] = ...) -> Task: ...
|
||||
@classmethod
|
||||
def all_tasks(cls, loop: AbstractEventLoop = ...) -> Set[Task]: ...
|
||||
def all_tasks(cls, loop: Optional[AbstractEventLoop] = ...) -> Set[Task]: ...
|
||||
def __init__(self, coro: Union[Generator[Any, None, _T], Awaitable[_T]], *, loop: AbstractEventLoop = ...) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def get_stack(self, *, limit: int = ...) -> List[FrameType]: ...
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
# Stubs for builtins (Python 3)
|
||||
# True and False are deliberately omitted because they are keywords in
|
||||
# Python 3, and stub files conform to Python 3 syntax.
|
||||
|
||||
from typing import (
|
||||
TypeVar, Iterator, Iterable, overload, Container,
|
||||
Sequence, MutableSequence, Mapping, MutableMapping, NoReturn, Tuple, List, Any, Dict, Callable, Generic,
|
||||
Set, AbstractSet, FrozenSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat,
|
||||
SupportsComplex, SupportsBytes, SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView,
|
||||
ValuesView, ByteString, Optional, AnyStr, Type,
|
||||
TypeVar, Iterator, Iterable, NoReturn, overload, Container,
|
||||
Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic,
|
||||
Set, AbstractSet, FrozenSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
|
||||
SupportsComplex, SupportsRound, IO, BinaryIO, Union,
|
||||
ItemsView, KeysView, ValuesView, ByteString, Optional, AnyStr, Type, Text,
|
||||
)
|
||||
from abc import abstractmethod, ABCMeta
|
||||
from ast import mod
|
||||
from types import TracebackType, CodeType
|
||||
import sys
|
||||
|
||||
# Note that names imported above are not automatically made visible via the
|
||||
# implicit builtins import.
|
||||
from typing import SupportsBytes
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T_co = TypeVar('_T_co', covariant=True)
|
||||
@@ -27,14 +28,17 @@ _T5 = TypeVar('_T5')
|
||||
_TT = TypeVar('_TT', bound='type')
|
||||
|
||||
class object:
|
||||
__doc__ = ... # type: Optional[str]
|
||||
__class__ = ... # type: type
|
||||
__dict__ = ... # type: Dict[str, Any]
|
||||
__slots__ = ... # type: Union[str, Iterable[str]]
|
||||
__module__ = ... # type: str
|
||||
__doc__: Optional[str]
|
||||
__dict__: Dict[str, Any]
|
||||
__slots__: Union[Text, Iterable[Text]]
|
||||
__module__: str
|
||||
if sys.version_info >= (3, 6):
|
||||
__annotations__ = ... # type: Dict[str, Any]
|
||||
__annotations__: Dict[str, Any]
|
||||
|
||||
@property
|
||||
def __class__(self: _T) -> Type[_T]: ...
|
||||
@__class__.setter
|
||||
def __class__(self, __type: Type[object]) -> None: ...
|
||||
def __init__(self) -> None: ...
|
||||
def __new__(cls) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||
@@ -54,29 +58,36 @@ class object:
|
||||
if sys.version_info >= (3, 6):
|
||||
def __init_subclass__(cls) -> None: ...
|
||||
|
||||
class staticmethod: # Special, only valid as a decorator.
|
||||
__func__ = ... # type: function
|
||||
__isabstractmethod__ = ... # type: bool
|
||||
class staticmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable
|
||||
__isabstractmethod__: bool
|
||||
|
||||
def __init__(self, f: function) -> None: ...
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
|
||||
class classmethod: # Special, only valid as a decorator.
|
||||
__func__ = ... # type: function
|
||||
__isabstractmethod__ = ... # type: bool
|
||||
class classmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable
|
||||
__isabstractmethod__: bool
|
||||
|
||||
def __init__(self, f: function) -> None: ...
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
|
||||
class type:
|
||||
__bases__ = ... # type: Tuple[type, ...]
|
||||
__name__ = ... # type: str
|
||||
__qualname__ = ... # type: str
|
||||
__module__ = ... # type: str
|
||||
__dict__ = ... # type: Dict[str, Any]
|
||||
__mro__ = ... # type: Tuple[type, ...]
|
||||
class type(object):
|
||||
__base__: type
|
||||
__bases__: Tuple[type, ...]
|
||||
__basicsize__: int
|
||||
__dict__: Dict[str, Any]
|
||||
__dictoffset__: int
|
||||
__flags__: int
|
||||
__itemsize__: int
|
||||
__module__: str
|
||||
__mro__: Tuple[type, ...]
|
||||
__name__: str
|
||||
__qualname__: str
|
||||
__text_signature__: Optional[str]
|
||||
__weakrefoffset__: int
|
||||
|
||||
@overload
|
||||
def __init__(self, o: object) -> None: ...
|
||||
@@ -93,8 +104,10 @@ class type:
|
||||
def mro(self) -> List[type]: ...
|
||||
def __instancecheck__(self, instance: Any) -> bool: ...
|
||||
def __subclasscheck__(self, subclass: type) -> bool: ...
|
||||
@classmethod
|
||||
def __prepare__(metacls, __name: str, __bases: Tuple[type, ...], **kwds: Any) -> Mapping[str, Any]: ...
|
||||
|
||||
class super:
|
||||
class super(object):
|
||||
@overload
|
||||
def __init__(self, t: Any, obj: Any) -> None: ...
|
||||
@overload
|
||||
@@ -104,9 +117,19 @@ class super:
|
||||
|
||||
class int:
|
||||
@overload
|
||||
def __init__(self, x: Union[str, bytes, SupportsInt] = ...) -> None: ...
|
||||
def __init__(self, x: Union[Text, bytes, SupportsInt] = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: Union[str, bytes], base: int) -> None: ...
|
||||
def __init__(self, x: Union[Text, bytes, bytearray], base: int) -> None: ...
|
||||
|
||||
@property
|
||||
def real(self) -> int: ...
|
||||
@property
|
||||
def imag(self) -> int: ...
|
||||
@property
|
||||
def numerator(self) -> int: ...
|
||||
@property
|
||||
def denominator(self) -> int: ...
|
||||
def conjugate(self) -> int: ...
|
||||
|
||||
def bit_length(self) -> int: ...
|
||||
def to_bytes(self, length: int, byteorder: str, *, signed: bool = ...) -> bytes: ...
|
||||
@@ -144,6 +167,7 @@ class int:
|
||||
def __pos__(self) -> int: ...
|
||||
def __invert__(self) -> int: ...
|
||||
def __round__(self, ndigits: Optional[int] = ...) -> int: ...
|
||||
def __getnewargs__(self) -> Tuple[int]: ...
|
||||
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
@@ -161,13 +185,19 @@ class int:
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
class float:
|
||||
def __init__(self, x: Union[SupportsFloat, str, bytes] = ...) -> None: ...
|
||||
def __init__(self, x: Union[SupportsFloat, Text, bytes, bytearray] = ...) -> 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: ...
|
||||
|
||||
@property
|
||||
def real(self) -> float: ...
|
||||
@property
|
||||
def imag(self) -> float: ...
|
||||
def conjugate(self) -> float: ...
|
||||
|
||||
def __add__(self, x: float) -> float: ...
|
||||
def __sub__(self, x: float) -> float: ...
|
||||
def __mul__(self, x: float) -> float: ...
|
||||
@@ -175,7 +205,7 @@ class float:
|
||||
def __truediv__(self, x: float) -> float: ...
|
||||
def __mod__(self, x: float) -> float: ...
|
||||
def __divmod__(self, x: float) -> Tuple[float, float]: ...
|
||||
def __pow__(self, x: float) -> float: ...
|
||||
def __pow__(self, x: float) -> float: ... # In Python 3, returns complex if self is negative and x is not whole
|
||||
def __radd__(self, x: float) -> float: ...
|
||||
def __rsub__(self, x: float) -> float: ...
|
||||
def __rmul__(self, x: float) -> float: ...
|
||||
@@ -184,6 +214,7 @@ class float:
|
||||
def __rmod__(self, x: float) -> float: ...
|
||||
def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
|
||||
def __rpow__(self, x: float) -> float: ...
|
||||
def __getnewargs__(self) -> Tuple[float]: ...
|
||||
@overload
|
||||
def __round__(self) -> int: ...
|
||||
@overload
|
||||
@@ -244,24 +275,27 @@ class complex:
|
||||
def __hash__(self) -> int: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
|
||||
class str(Sequence[str]):
|
||||
_str_base = object
|
||||
|
||||
class str(Sequence[str], _str_base):
|
||||
@overload
|
||||
def __init__(self, o: object = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, o: bytes, encoding: str = ..., errors: str = ...) -> None: ...
|
||||
|
||||
def capitalize(self) -> str: ...
|
||||
def casefold(self) -> str: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def casefold(self) -> str: ...
|
||||
def center(self, width: int, fillchar: str = ...) -> str: ...
|
||||
def count(self, x: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def encode(self, encoding: str = ..., errors: str = ...) -> bytes: ...
|
||||
def endswith(self, suffix: Union[str, Tuple[str, ...]], start: Optional[int] = ...,
|
||||
def count(self, x: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ...
|
||||
def endswith(self, suffix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ...,
|
||||
end: Optional[int] = ...) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> str: ...
|
||||
def find(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def format(self, *args: Any, **kwargs: Any) -> str: ...
|
||||
def format_map(self, map: Mapping[str, Any]) -> str: ...
|
||||
def index(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
def isalpha(self) -> bool: ...
|
||||
def isdecimal(self) -> bool: ...
|
||||
@@ -279,15 +313,15 @@ class str(Sequence[str]):
|
||||
def lstrip(self, chars: Optional[str] = ...) -> str: ...
|
||||
def partition(self, sep: str) -> Tuple[str, str, str]: ...
|
||||
def replace(self, old: str, new: str, count: int = ...) -> str: ...
|
||||
def rfind(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rindex(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rfind(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rindex(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def rjust(self, width: int, fillchar: str = ...) -> str: ...
|
||||
def rpartition(self, sep: str) -> Tuple[str, str, str]: ...
|
||||
def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
|
||||
def rstrip(self, chars: Optional[str] = ...) -> str: ...
|
||||
def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[str]: ...
|
||||
def startswith(self, prefix: Union[str, Tuple[str, ...]], start: Optional[int] = ...,
|
||||
def startswith(self, prefix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ...,
|
||||
end: Optional[int] = ...) -> bool: ...
|
||||
def strip(self, chars: Optional[str] = ...) -> str: ...
|
||||
def swapcase(self) -> str: ...
|
||||
@@ -302,24 +336,24 @@ class str(Sequence[str]):
|
||||
@overload
|
||||
def maketrans(x: str, y: str, z: str = ...) -> Dict[int, Union[int, None]]: ...
|
||||
|
||||
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, value: Any) -> str: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
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: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __ge__(self, x: Text) -> bool: ...
|
||||
def __getitem__(self, i: Union[int, slice]) -> str: ...
|
||||
def __gt__(self, x: Text) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __le__(self, x: Text) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __lt__(self, x: Text) -> bool: ...
|
||||
def __mod__(self, x: Any) -> str: ...
|
||||
def __mul__(self, n: int) -> str: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __rmul__(self, n: int) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __getnewargs__(self) -> Tuple[str]: ...
|
||||
|
||||
class bytes(ByteString):
|
||||
@overload
|
||||
@@ -364,7 +398,12 @@ class bytes(ByteString):
|
||||
def rstrip(self, chars: Optional[bytes] = ...) -> bytes: ...
|
||||
def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytes]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[bytes]: ...
|
||||
def startswith(self, prefix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
|
||||
def startswith(
|
||||
self,
|
||||
prefix: Union[bytes, Tuple[bytes, ...]],
|
||||
start: Optional[int] = ...,
|
||||
end: Optional[int] = ...,
|
||||
) -> bool: ...
|
||||
def strip(self, chars: Optional[bytes] = ...) -> bytes: ...
|
||||
def swapcase(self) -> bytes: ...
|
||||
def title(self) -> bytes: ...
|
||||
@@ -399,22 +438,23 @@ class bytes(ByteString):
|
||||
def __le__(self, x: bytes) -> bool: ...
|
||||
def __gt__(self, x: bytes) -> bool: ...
|
||||
def __ge__(self, x: bytes) -> bool: ...
|
||||
def __getnewargs__(self) -> Tuple[bytes]: ...
|
||||
|
||||
class bytearray(MutableSequence[int], ByteString):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, ints: Iterable[int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, string: str, encoding: str, errors: str = ...) -> None: ...
|
||||
def __init__(self, string: Text, encoding: Text, errors: Text = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, length: int) -> None: ...
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
def capitalize(self) -> bytearray: ...
|
||||
def center(self, width: int, fillchar: bytes = ...) -> bytearray: ...
|
||||
def count(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
|
||||
def copy(self) -> bytearray: ...
|
||||
def decode(self, encoding: str = ..., errors: str = ...) -> str: ...
|
||||
def endswith(self, suffix: bytes) -> bool: ...
|
||||
def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ...
|
||||
def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> bytearray: ...
|
||||
def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
@@ -442,15 +482,20 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def rstrip(self, chars: Optional[bytes] = ...) -> bytearray: ...
|
||||
def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
|
||||
def startswith(self, prefix: bytes) -> bool: ...
|
||||
def startswith(
|
||||
self,
|
||||
prefix: Union[bytes, Tuple[bytes, ...]],
|
||||
start: Optional[int] = ...,
|
||||
end: Optional[int] = ...,
|
||||
) -> bool: ...
|
||||
def strip(self, chars: Optional[bytes] = ...) -> bytearray: ...
|
||||
def swapcase(self) -> bytearray: ...
|
||||
def title(self) -> bytearray: ...
|
||||
def translate(self, table: Optional[bytes], delete: bytes = ...) -> bytearray: ...
|
||||
def upper(self) -> bytearray: ...
|
||||
def zfill(self, width: int) -> bytearray: ...
|
||||
@classmethod
|
||||
def fromhex(cls, s: str) -> bytearray: ...
|
||||
@staticmethod
|
||||
def fromhex(s: str) -> bytearray: ...
|
||||
@classmethod
|
||||
def maketrans(cls, frm: bytes, to: bytes) -> bytes: ...
|
||||
|
||||
@@ -485,26 +530,31 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def __gt__(self, x: bytes) -> bool: ...
|
||||
def __ge__(self, x: bytes) -> bool: ...
|
||||
|
||||
class memoryview(Sized, Container[int]):
|
||||
format = ... # type: str
|
||||
itemsize = ... # type: int
|
||||
shape = ... # type: Optional[Tuple[int, ...]]
|
||||
strides = ... # type: Optional[Tuple[int, ...]]
|
||||
suboffsets = ... # type: Optional[Tuple[int, ...]]
|
||||
readonly = ... # type: bool
|
||||
ndim = ... # type: int
|
||||
_mv_container_type = int
|
||||
|
||||
class memoryview(Sized, Container[_mv_container_type]):
|
||||
format: str
|
||||
itemsize: int
|
||||
shape: Optional[Tuple[int, ...]]
|
||||
strides: Optional[Tuple[int, ...]]
|
||||
suboffsets: Optional[Tuple[int, ...]]
|
||||
readonly: bool
|
||||
ndim: int
|
||||
|
||||
c_contiguous: bool
|
||||
f_contiguous: bool
|
||||
contiguous: bool
|
||||
def __init__(self, obj: Union[bytes, bytearray, memoryview]) -> None: ...
|
||||
def __enter__(self) -> memoryview: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ...
|
||||
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
def __getitem__(self, i: int) -> _mv_container_type: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> memoryview: ...
|
||||
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[int]: ...
|
||||
def __iter__(self) -> Iterator[_mv_container_type]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@overload
|
||||
@@ -522,35 +572,36 @@ class memoryview(Sized, Container[int]):
|
||||
|
||||
class bool(int):
|
||||
def __init__(self, o: object = ...) -> None: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __and__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __and__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __or__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __or__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __xor__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __xor__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rand__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rand__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __ror__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __ror__(self, x: int) -> int: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rxor__(self, x: bool) -> bool: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def __rxor__(self, x: int) -> int: ...
|
||||
def __getnewargs__(self) -> Tuple[int]: ...
|
||||
|
||||
class slice:
|
||||
start = ... # type: Optional[int]
|
||||
step = ... # type: Optional[int]
|
||||
stop = ... # type: Optional[int]
|
||||
class slice(object):
|
||||
start: Optional[int]
|
||||
step: Optional[int]
|
||||
stop: Optional[int]
|
||||
@overload
|
||||
def __init__(self, stop: Optional[int]) -> None: ...
|
||||
@overload
|
||||
@@ -581,11 +632,11 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
|
||||
class function:
|
||||
# TODO not defined in builtins!
|
||||
__name__ = ... # type: str
|
||||
__qualname__ = ... # type: str
|
||||
__module__ = ... # type: str
|
||||
__code__ = ... # type: CodeType
|
||||
__annotations__ = ... # type: Dict[str, Any]
|
||||
__name__: str
|
||||
__module__: str
|
||||
__qualname__: str
|
||||
__code__: CodeType
|
||||
__annotations__: Dict[str, Any]
|
||||
|
||||
class list(MutableSequence[_T], Generic[_T]):
|
||||
@overload
|
||||
@@ -618,10 +669,10 @@ class list(MutableSequence[_T], Generic[_T]):
|
||||
def __setitem__(self, s: slice, o: Iterable[_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 __iadd__(self: _S, x: Iterable[_T]) -> _S: ...
|
||||
def __mul__(self, n: int) -> List[_T]: ...
|
||||
def __rmul__(self, n: int) -> List[_T]: ...
|
||||
def __imul__(self, n: int) -> List[_T]: ...
|
||||
def __imul__(self: _S, n: int) -> _S: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __reversed__(self) -> Iterator[_T]: ...
|
||||
def __gt__(self, x: List[_T]) -> bool: ...
|
||||
@@ -644,7 +695,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def clear(self) -> None: ...
|
||||
def copy(self) -> Dict[_KT, _VT]: ...
|
||||
def popitem(self) -> Tuple[_KT, _VT]: ...
|
||||
def setdefault(self, k: _KT, default: Optional[_VT] = ...) -> _VT: ...
|
||||
def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
|
||||
@overload
|
||||
def update(self, __m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
@@ -672,10 +723,10 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
def add(self, element: _T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def copy(self) -> Set[_T]: ...
|
||||
def difference(self, *s: Iterable[object]) -> Set[_T]: ...
|
||||
def difference_update(self, *s: Iterable[object]) -> None: ...
|
||||
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[object]) -> Set[_T]: ...
|
||||
def intersection(self, *s: Iterable[Any]) -> Set[_T]: ...
|
||||
def intersection_update(self, *s: Iterable[Any]) -> None: ...
|
||||
def isdisjoint(self, s: Iterable[Any]) -> bool: ...
|
||||
def issubset(self, s: Iterable[Any]) -> bool: ...
|
||||
@@ -732,9 +783,9 @@ class enumerate(Iterator[Tuple[int, _T]], Generic[_T]):
|
||||
def __next__(self) -> Tuple[int, _T]: ...
|
||||
|
||||
class range(Sequence[int]):
|
||||
start = ... # type: int
|
||||
stop = ... # type: int
|
||||
step = ... # type: int
|
||||
start: int
|
||||
stop: int
|
||||
step: int
|
||||
@overload
|
||||
def __init__(self, stop: int) -> None: ...
|
||||
@overload
|
||||
@@ -751,7 +802,7 @@ class range(Sequence[int]):
|
||||
def __repr__(self) -> str: ...
|
||||
def __reversed__(self) -> Iterator[int]: ...
|
||||
|
||||
class property:
|
||||
class property(object):
|
||||
def __init__(self, fget: Optional[Callable[[Any], Any]] = ...,
|
||||
fset: Optional[Callable[[Any, Any], None]] = ...,
|
||||
fdel: Optional[Callable[[Any], None]] = ...,
|
||||
@@ -766,7 +817,7 @@ class property:
|
||||
def fset(self, value: Any) -> None: ...
|
||||
def fdel(self) -> None: ...
|
||||
|
||||
NotImplemented = ... # type: Any
|
||||
NotImplemented: Any
|
||||
|
||||
def abs(n: SupportsAbs[_T]) -> _T: ...
|
||||
def all(i: Iterable[object]) -> bool: ...
|
||||
@@ -783,31 +834,31 @@ if sys.version_info >= (3, 6):
|
||||
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
|
||||
class _PathLike(Generic[AnyStr]):
|
||||
def __fspath__(self) -> AnyStr: ...
|
||||
def compile(source: Any, filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ...) -> CodeType: ...
|
||||
def compile(source: Union[str, bytes, mod], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
else:
|
||||
def compile(source: Any, filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ...) -> CodeType: ...
|
||||
def compile(source: Union[str, bytes, mod], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
def copyright() -> None: ...
|
||||
def credits() -> None: ...
|
||||
def delattr(o: Any, name: str) -> None: ...
|
||||
def delattr(o: Any, name: Text) -> None: ...
|
||||
def dir(o: object = ...) -> List[str]: ...
|
||||
_N = TypeVar('_N', int, float)
|
||||
def divmod(a: _N, b: _N) -> Tuple[_N, _N]: ...
|
||||
def eval(source: Union[str, bytes, CodeType], globals: Optional[Dict[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> Any: ...
|
||||
_N2 = TypeVar('_N2', int, float)
|
||||
def divmod(a: _N2, b: _N2) -> Tuple[_N2, _N2]: ...
|
||||
def eval(source: Union[Text, bytes, CodeType], globals: Optional[Dict[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> Any: ...
|
||||
def exec(object: Union[str, bytes, CodeType], globals: Optional[Dict[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> Any: ...
|
||||
def exit(code: Any = ...) -> NoReturn: ...
|
||||
@overload
|
||||
def filter(function: None, iterable: Iterable[Optional[_T]]) -> Iterator[_T]: ...
|
||||
def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> Iterator[_T]: ...
|
||||
@overload
|
||||
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 = ...) -> Any: ...
|
||||
def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
def format(o: object, format_spec: str = ...) -> str: ... # TODO unicode
|
||||
def getattr(o: Any, name: Text, default: Any = ...) -> Any: ...
|
||||
def globals() -> Dict[str, Any]: ...
|
||||
def hasattr(o: Any, name: str) -> bool: ...
|
||||
def hasattr(o: Any, name: Text) -> 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: Optional[Any] = ...) -> str: ...
|
||||
def input(prompt: Any = ...) -> str: ...
|
||||
@overload
|
||||
def iter(iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
@overload
|
||||
@@ -870,8 +921,8 @@ else:
|
||||
def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...) -> IO[Any]: ...
|
||||
|
||||
def ord(c: Union[str, bytes, bytearray]) -> int: ...
|
||||
def print(*values: Any, sep: str = ..., end: str = ..., file: Optional[IO[str]] = ..., flush: bool = ...) -> None: ...
|
||||
def ord(c: Union[Text, bytes]) -> int: ...
|
||||
def print(*values: Any, sep: Text = ..., end: Text = ..., file: Optional[IO[str]] = ..., flush: bool = ...) -> None: ...
|
||||
@overload
|
||||
def pow(x: int, y: int) -> Any: ... # The return type can be int or float, depending on y
|
||||
@overload
|
||||
@@ -898,7 +949,7 @@ def round(number: SupportsRound[_T]) -> int: ...
|
||||
def round(number: SupportsRound[_T], ndigits: None) -> int: ... # type: ignore
|
||||
@overload
|
||||
def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
|
||||
def setattr(object: Any, name: str, value: Any) -> None: ...
|
||||
def setattr(object: Any, name: Text, value: Any) -> None: ...
|
||||
def sorted(iterable: Iterable[_T], *,
|
||||
key: Optional[Callable[[_T], Any]] = ...,
|
||||
reverse: bool = ...) -> List[_T]: ...
|
||||
@@ -916,72 +967,89 @@ 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]]: ...
|
||||
iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2,
|
||||
_T3, _T4, _T5]]: ...
|
||||
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||
@overload
|
||||
def zip(iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any],
|
||||
iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any],
|
||||
*iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ...
|
||||
def __import__(name: str, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...,
|
||||
def __import__(name: Text, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...,
|
||||
fromlist: List[str] = ..., level: int = ...) -> Any: ...
|
||||
|
||||
# Ellipsis
|
||||
|
||||
# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
|
||||
# not exposed anywhere under that name, we make it private here.
|
||||
class ellipsis: ...
|
||||
Ellipsis = ... # type: ellipsis
|
||||
Ellipsis: ellipsis
|
||||
|
||||
# Exceptions
|
||||
|
||||
class BaseException:
|
||||
args = ... # type: Tuple[Any, ...]
|
||||
__cause__ = ... # type: Optional[BaseException]
|
||||
__context__ = ... # type: Optional[BaseException]
|
||||
__traceback__ = ... # type: Optional[TracebackType]
|
||||
class BaseException(object):
|
||||
args: Tuple[Any, ...]
|
||||
__cause__: Optional[BaseException]
|
||||
__context__: Optional[BaseException]
|
||||
__traceback__: Optional[TracebackType]
|
||||
def __init__(self, *args: object) -> None: ...
|
||||
def with_traceback(self, tb: Optional[TracebackType]) -> BaseException: ...
|
||||
|
||||
class GeneratorExit(BaseException): ...
|
||||
class KeyboardInterrupt(BaseException): ...
|
||||
class SystemExit(BaseException):
|
||||
code = 0
|
||||
code: int
|
||||
class Exception(BaseException): ...
|
||||
class ArithmeticError(Exception): ...
|
||||
class StopIteration(Exception):
|
||||
value: Any
|
||||
_StandardError = Exception
|
||||
class OSError(Exception):
|
||||
errno = 0
|
||||
strerror = ... # type: str
|
||||
errno: int
|
||||
strerror: str
|
||||
# filename, filename2 are actually Union[str, bytes, None]
|
||||
filename = ... # type: Any
|
||||
filename2 = ... # type: Any
|
||||
IOError = OSError
|
||||
filename: Any
|
||||
filename2: Any
|
||||
EnvironmentError = OSError
|
||||
class WindowsError(OSError):
|
||||
winerror = ... # type: int
|
||||
class LookupError(Exception): ...
|
||||
class RuntimeError(Exception): ...
|
||||
class ValueError(Exception): ...
|
||||
class AssertionError(Exception): ...
|
||||
class AttributeError(Exception): ...
|
||||
class BufferError(Exception): ...
|
||||
class EOFError(Exception): ...
|
||||
IOError = OSError
|
||||
|
||||
class ArithmeticError(_StandardError): ...
|
||||
class AssertionError(_StandardError): ...
|
||||
class AttributeError(_StandardError): ...
|
||||
class BufferError(_StandardError): ...
|
||||
class EOFError(_StandardError): ...
|
||||
class ImportError(_StandardError):
|
||||
name: str
|
||||
path: str
|
||||
class LookupError(_StandardError): ...
|
||||
class MemoryError(_StandardError): ...
|
||||
class NameError(_StandardError): ...
|
||||
class ReferenceError(_StandardError): ...
|
||||
class RuntimeError(_StandardError): ...
|
||||
if sys.version_info >= (3, 5):
|
||||
class StopAsyncIteration(Exception):
|
||||
value: Any
|
||||
class SyntaxError(_StandardError):
|
||||
msg: str
|
||||
lineno: int
|
||||
offset: Optional[int]
|
||||
text: str
|
||||
filename: str
|
||||
class SystemError(_StandardError): ...
|
||||
class TypeError(_StandardError): ...
|
||||
class ValueError(_StandardError): ...
|
||||
|
||||
class FloatingPointError(ArithmeticError): ...
|
||||
class ImportError(Exception):
|
||||
name = ... # type: str
|
||||
path = ... # type: str
|
||||
class OverflowError(ArithmeticError): ...
|
||||
class ZeroDivisionError(ArithmeticError): ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
class ModuleNotFoundError(ImportError): ...
|
||||
|
||||
class IndexError(LookupError): ...
|
||||
class KeyError(LookupError): ...
|
||||
class MemoryError(Exception): ...
|
||||
class NameError(Exception): ...
|
||||
class NotImplementedError(RuntimeError): ...
|
||||
|
||||
class UnboundLocalError(NameError): ...
|
||||
|
||||
class WindowsError(OSError):
|
||||
winerror: int
|
||||
class BlockingIOError(OSError):
|
||||
characters_written = 0
|
||||
characters_written: int
|
||||
class ChildProcessError(OSError): ...
|
||||
class ConnectionError(OSError): ...
|
||||
class BrokenPipeError(ConnectionError): ...
|
||||
@@ -996,44 +1064,32 @@ class NotADirectoryError(OSError): ...
|
||||
class PermissionError(OSError): ...
|
||||
class ProcessLookupError(OSError): ...
|
||||
class TimeoutError(OSError): ...
|
||||
class OverflowError(ArithmeticError): ...
|
||||
class ReferenceError(Exception): ...
|
||||
class StopIteration(Exception):
|
||||
value = ... # type: Any
|
||||
|
||||
class NotImplementedError(RuntimeError): ...
|
||||
if sys.version_info >= (3, 5):
|
||||
class StopAsyncIteration(Exception):
|
||||
value = ... # type: Any
|
||||
class RecursionError(RuntimeError): ...
|
||||
class SyntaxError(Exception):
|
||||
msg = ... # type: str
|
||||
lineno = ... # type: int
|
||||
offset = ... # type: int
|
||||
text = ... # type: str
|
||||
filename = ... # type: str
|
||||
|
||||
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
|
||||
encoding: str
|
||||
object: bytes
|
||||
start: int
|
||||
end: int
|
||||
reason: str
|
||||
def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int,
|
||||
__reason: str) -> None: ...
|
||||
class UnicodeEncodeError(UnicodeError):
|
||||
encoding = ... # type: str
|
||||
object = ... # type: str
|
||||
start = ... # type: int
|
||||
end = ... # type: int
|
||||
reason = ... # type: str
|
||||
def __init__(self, __encoding: str, __object: str, __start: int, __end: int,
|
||||
encoding: str
|
||||
object: Text
|
||||
start: int
|
||||
end: int
|
||||
reason: str
|
||||
def __init__(self, __encoding: str, __object: Text, __start: int, __end: int,
|
||||
__reason: str) -> None: ...
|
||||
class UnicodeTranslateError(UnicodeError): ...
|
||||
class ZeroDivisionError(ArithmeticError): ...
|
||||
|
||||
class Warning(Exception): ...
|
||||
class UserWarning(Warning): ...
|
||||
@@ -1045,4 +1101,5 @@ class PendingDeprecationWarning(Warning): ...
|
||||
class ImportWarning(Warning): ...
|
||||
class UnicodeWarning(Warning): ...
|
||||
class BytesWarning(Warning): ...
|
||||
class ResourceWarning(Warning): ...
|
||||
if sys.version_info >= (3, 2):
|
||||
class ResourceWarning(Warning): ...
|
||||
|
||||
@@ -42,6 +42,7 @@ if sys.version_info >= (3, 5):
|
||||
AsyncIterator as AsyncIterator,
|
||||
)
|
||||
|
||||
_S = TypeVar('_S')
|
||||
_T = TypeVar('_T')
|
||||
_KT = TypeVar('_KT')
|
||||
_VT = TypeVar('_VT')
|
||||
@@ -76,6 +77,7 @@ class UserDict(MutableMapping[_KT, _VT]):
|
||||
_UserListT = TypeVar('_UserListT', bound=UserList)
|
||||
|
||||
class UserList(MutableSequence[_T]):
|
||||
data: List[_T]
|
||||
def __init__(self, initlist: Optional[Iterable[_T]] = ...) -> None: ...
|
||||
def __lt__(self, other: object) -> bool: ...
|
||||
def __le__(self, other: object) -> bool: ...
|
||||
@@ -111,6 +113,7 @@ class UserList(MutableSequence[_T]):
|
||||
_UserStringT = TypeVar('_UserStringT', bound=UserString)
|
||||
|
||||
class UserString(Sequence[str]):
|
||||
data: str
|
||||
def __init__(self, seq: object) -> None: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
@@ -190,7 +193,7 @@ class deque(MutableSequence[_T], Generic[_T]):
|
||||
@property
|
||||
def maxlen(self) -> Optional[int]: ...
|
||||
def __init__(self, iterable: Iterable[_T] = ...,
|
||||
maxlen: int = ...) -> None: ...
|
||||
maxlen: Optional[int] = ...) -> None: ...
|
||||
def append(self, x: _T) -> None: ...
|
||||
def appendleft(self, x: _T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
@@ -233,6 +236,8 @@ class deque(MutableSequence[_T], Generic[_T]):
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __reversed__(self) -> Iterator[_T]: ...
|
||||
|
||||
def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ...
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
def __add__(self, other: deque[_T]) -> deque[_T]: ...
|
||||
def __mul__(self, other: int) -> deque[_T]: ...
|
||||
|
||||
@@ -141,7 +141,9 @@ class TextIOBase(IOBase):
|
||||
def __next__(self) -> str: ... # type: ignore
|
||||
def detach(self) -> IOBase: ...
|
||||
def write(self, s: str) -> int: ...
|
||||
def writelines(self, lines: List[str]) -> None: ... # type: ignore
|
||||
def readline(self, size: int = ...) -> str: ... # type: ignore
|
||||
def readlines(self, hint: int = ...) -> List[str]: ... # type: ignore
|
||||
def read(self, size: Optional[int] = ...) -> str: ...
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
def tell(self) -> int: ...
|
||||
|
||||
@@ -8,6 +8,7 @@ from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple,
|
||||
_T = TypeVar('_T')
|
||||
_S = TypeVar('_S')
|
||||
_N = TypeVar('_N', int, float)
|
||||
Predicate = Callable[[_T], object]
|
||||
|
||||
def count(start: _N = ...,
|
||||
step: _N = ...) -> Iterator[_N]: ... # more general types?
|
||||
@@ -28,16 +29,15 @@ class chain(Iterator[_T], Generic[_T]):
|
||||
def from_iterable(iterable: Iterable[Iterable[_S]]) -> Iterator[_S]: ...
|
||||
|
||||
def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ...
|
||||
def dropwhile(predicate: Callable[[_T], Any],
|
||||
def dropwhile(predicate: Predicate[_T],
|
||||
iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
def filterfalse(predicate: Optional[Callable[[_T], Any]],
|
||||
def filterfalse(predicate: Optional[Predicate[_T]],
|
||||
iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
|
||||
@overload
|
||||
def groupby(iterable: Iterable[_T]) -> Iterator[Tuple[_T, Iterator[_T]]]: ...
|
||||
def groupby(iterable: Iterable[_T], key: None = ...) -> Iterator[Tuple[_T, Iterator[_T]]]: ...
|
||||
@overload
|
||||
def groupby(iterable: Iterable[_T],
|
||||
key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ...
|
||||
def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ...
|
||||
|
||||
@overload
|
||||
def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ...
|
||||
@@ -46,7 +46,7 @@ def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int],
|
||||
step: Optional[int] = ...) -> Iterator[_T]: ...
|
||||
|
||||
def starmap(func: Callable[..., _S], iterable: Iterable[Iterable[Any]]) -> Iterator[_S]: ...
|
||||
def takewhile(predicate: Callable[[_T], Any],
|
||||
def takewhile(predicate: Predicate[_T],
|
||||
iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
def tee(iterable: Iterable[_T], n: int = ...) -> Tuple[Iterator[_T], ...]: ...
|
||||
def zip_longest(*p: Iterable[Any],
|
||||
@@ -96,7 +96,7 @@ def product(iter1: Iterable[Any],
|
||||
iter7: Iterable[Any],
|
||||
*iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ...
|
||||
@overload
|
||||
def product(*iterables: Iterable[Any], repeat: int) -> Iterator[Tuple[Any, ...]]: ...
|
||||
def product(*iterables: Iterable[Any], repeat: int = ...) -> Iterator[Tuple[Any, ...]]: ...
|
||||
|
||||
def permutations(iterable: Iterable[_T],
|
||||
r: Optional[int] = ...) -> Iterator[Tuple[_T, ...]]: ...
|
||||
|
||||
@@ -1,15 +1,34 @@
|
||||
from typing import Any, Iterable, List, Optional, Tuple, Type, Union
|
||||
import socket
|
||||
import sys
|
||||
import types
|
||||
|
||||
# https://docs.python.org/3/library/multiprocessing.html#address-formats
|
||||
_Address = Union[str, Tuple[str, int]]
|
||||
|
||||
def deliver_challenge(connection: Connection, authkey: bytes) -> None: ...
|
||||
def answer_challenge(connection: Connection, authkey: bytes) -> None: ...
|
||||
def wait(object_list: Iterable[Union[Connection, socket.socket, int]], timeout: Optional[float] = ...) -> List[Union[Connection, socket.socket, int]]: ...
|
||||
def Client(address: _Address, family: Optional[str] = ..., authkey: Optional[bytes] = ...) -> Connection: ...
|
||||
def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ...
|
||||
class _ConnectionBase:
|
||||
@property
|
||||
def closed(self) -> bool: ... # undocumented
|
||||
@property
|
||||
def readable(self) -> bool: ... # undocumented
|
||||
@property
|
||||
def writable(self) -> bool: ... # undocumented
|
||||
def fileno(self) -> int: ...
|
||||
def close(self) -> None: ...
|
||||
def send_bytes(self,
|
||||
buf: bytes,
|
||||
offset: int = ...,
|
||||
size: Optional[int] = ...) -> None: ...
|
||||
def send(self, obj: Any) -> None: ...
|
||||
def recv_bytes(self, maxlength: Optional[int] = ...) -> bytes: ...
|
||||
def recv_bytes_into(self, buf: Any, offset: int = ...) -> int: ...
|
||||
def recv(self) -> Any: ...
|
||||
def poll(self, timeout: Optional[float] = ...) -> bool: ...
|
||||
|
||||
class Connection(_ConnectionBase): ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
class PipeConnection(_ConnectionBase): ...
|
||||
|
||||
class Listener:
|
||||
def __init__(self, address: Optional[_Address] = ..., family: Optional[str] = ..., backlog: int = ..., authkey: Optional[bytes] = ...) -> None: ...
|
||||
@@ -22,15 +41,8 @@ class Listener:
|
||||
def __enter__(self) -> Listener: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], exc_tb: Optional[types.TracebackType]) -> None: ...
|
||||
|
||||
class Connection:
|
||||
def close(self) -> None: ...
|
||||
def fileno(self) -> int: ...
|
||||
def poll(self, timeout: Optional[float] = ...) -> bool: ...
|
||||
def recv(self) -> Any: ...
|
||||
def recv_bytes(self, maxlength: Optional[int] = ...) -> bytes: ...
|
||||
def recv_bytes_into(self, buf: Any, offset: int = ...) -> int: ...
|
||||
def send(self, obj: Any) -> None: ...
|
||||
def send_bytes(self,
|
||||
buf: bytes,
|
||||
offset: int = ...,
|
||||
size: Optional[int] = ...) -> None: ...
|
||||
def deliver_challenge(connection: Connection, authkey: bytes) -> None: ...
|
||||
def answer_challenge(connection: Connection, authkey: bytes) -> None: ...
|
||||
def wait(object_list: Iterable[Union[Connection, socket.socket, int]], timeout: Optional[float] = ...) -> List[Union[Connection, socket.socket, int]]: ...
|
||||
def Client(address: _Address, family: Optional[str] = ..., authkey: Optional[bytes] = ...) -> Connection: ...
|
||||
def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ...
|
||||
|
||||
@@ -18,7 +18,7 @@ class Connection(object):
|
||||
def __exit__(self, exc_type, exc_value, exc_tb) -> None: ...
|
||||
def __init__(self, _in, _out) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def poll(self, timeout: float=...) -> bool: ...
|
||||
def poll(self, timeout: float = ...) -> bool: ...
|
||||
|
||||
class Listener(object):
|
||||
_backlog_queue = ... # type: Optional[Queue]
|
||||
@@ -32,4 +32,4 @@ class Listener(object):
|
||||
|
||||
|
||||
def Client(address) -> Connection: ...
|
||||
def Pipe(duplex: bool=...) -> Tuple[Connection, Connection]: ...
|
||||
def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ...
|
||||
|
||||
@@ -20,6 +20,8 @@ class IMapIterator(Iterable[_T]):
|
||||
def next(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
def __next__(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
|
||||
class IMapUnorderedIterator(IMapIterator): ...
|
||||
|
||||
class Pool(ContextManager[Pool]):
|
||||
def __init__(self, processes: Optional[int] = ...,
|
||||
initializer: Optional[Callable[..., None]] = ...,
|
||||
@@ -31,11 +33,11 @@ class Pool(ContextManager[Pool]):
|
||||
args: Iterable[Any] = ...,
|
||||
kwds: Mapping[str, Any] = ...) -> _T: ...
|
||||
def apply_async(self,
|
||||
func: Callable[..., _T],
|
||||
args: Iterable[Any] = ...,
|
||||
kwds: Mapping[str, Any] = ...,
|
||||
callback: Optional[Callable[[_T], None]] = ...,
|
||||
error_callback: Optional[Callable[[BaseException], None]] = ...) -> AsyncResult[_T]: ...
|
||||
func: Callable[..., _T],
|
||||
args: Iterable[Any] = ...,
|
||||
kwds: Mapping[str, Any] = ...,
|
||||
callback: Optional[Callable[[_T], None]] = ...,
|
||||
error_callback: Optional[Callable[[BaseException], None]] = ...) -> AsyncResult[_T]: ...
|
||||
def map(self,
|
||||
func: Callable[[_S], _T],
|
||||
iterable: Iterable[_S] = ...,
|
||||
|
||||
@@ -31,6 +31,8 @@ class PurePath(_PurePathBase):
|
||||
def __gt__(self, other: PurePath) -> bool: ...
|
||||
def __ge__(self, other: PurePath) -> bool: ...
|
||||
def __truediv__(self: _P, key: Union[str, PurePath]) -> _P: ...
|
||||
if sys.version_info < (3,):
|
||||
def __div__(self: _P, key: Union[str, PurePath]) -> _P: ...
|
||||
def __bytes__(self) -> bytes: ...
|
||||
def as_posix(self) -> str: ...
|
||||
def as_uri(self) -> str: ...
|
||||
|
||||
@@ -158,7 +158,32 @@ def check_call(args: _CMD,
|
||||
pass_fds: Any = ...,
|
||||
timeout: float = ...) -> int: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
if sys.version_info >= (3, 7):
|
||||
# 3.7 added text
|
||||
def check_output(args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: _PATH = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Callable[[], Any] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[_PATH] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
creationflags: int = ...,
|
||||
restore_signals: bool = ...,
|
||||
start_new_session: bool = ...,
|
||||
pass_fds: Any = ...,
|
||||
*,
|
||||
timeout: float = ...,
|
||||
input: _TXT = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...,
|
||||
text: Optional[bool] = ...,
|
||||
) -> Any: ... # morally: -> _TXT
|
||||
elif sys.version_info >= (3, 6):
|
||||
# 3.6 added encoding and errors
|
||||
def check_output(args: _CMD,
|
||||
bufsize: int = ...,
|
||||
|
||||
@@ -47,7 +47,7 @@ class CodeType:
|
||||
co_consts = ... # type: Tuple[Any, ...]
|
||||
co_names = ... # type: Tuple[str, ...]
|
||||
co_varnames = ... # type: Tuple[str, ...]
|
||||
co_filename = ... # type: Optional[str]
|
||||
co_filename = ... # type: str
|
||||
co_name = ... # type: str
|
||||
co_firstlineno = ... # type: int
|
||||
co_lnotab = ... # type: bytes
|
||||
|
||||
@@ -163,6 +163,15 @@ class Awaitable(Protocol[_T_co]):
|
||||
def __await__(self) -> Generator[Any, None, _T_co]: ...
|
||||
|
||||
class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]):
|
||||
@property
|
||||
def cr_await(self) -> Optional[Any]: ...
|
||||
@property
|
||||
def cr_code(self) -> CodeType: ...
|
||||
@property
|
||||
def cr_frame(self) -> FrameType: ...
|
||||
@property
|
||||
def cr_running(self) -> bool: ...
|
||||
|
||||
@abstractmethod
|
||||
def send(self, value: _T_contra) -> _T_co: ...
|
||||
|
||||
@@ -175,7 +184,7 @@ class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]):
|
||||
|
||||
|
||||
# NOTE: This type does not exist in typing.py or PEP 484.
|
||||
# The parameters corrrespond to Generator, but the 4th is the original type.
|
||||
# The parameters correspond to Generator, but the 4th is the original type.
|
||||
class AwaitableGenerator(Awaitable[_V_co], Generator[_T_co, _T_contra, _V_co],
|
||||
Generic[_T_co, _T_contra, _V_co, _S], metaclass=ABCMeta): ...
|
||||
|
||||
@@ -204,7 +213,7 @@ if sys.version_info >= (3, 6):
|
||||
tb: Any = ...) -> Awaitable[_T_co]: ...
|
||||
|
||||
@abstractmethod
|
||||
def aclose(self) -> Awaitable[_T_co]: ...
|
||||
def aclose(self) -> Awaitable[None]: ...
|
||||
|
||||
@abstractmethod
|
||||
def __aiter__(self) -> AsyncGenerator[_T_co, _T_contra]: ...
|
||||
@@ -226,11 +235,18 @@ class Container(Protocol[_T_co]):
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
@runtime
|
||||
class Collection(Sized, Iterable[_T_co], Container[_T_co], Protocol[_T_co]): ...
|
||||
class Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]):
|
||||
# Implement Sized (but don't have it as a base class).
|
||||
@abstractmethod
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
_Collection = Collection
|
||||
else:
|
||||
@runtime
|
||||
class _Collection(Sized, Iterable[_T_co], Container[_T_co], Protocol[_T_co]): ...
|
||||
class _Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]):
|
||||
# Implement Sized (but don't have it as a base class).
|
||||
@abstractmethod
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class Sequence(_Collection[_T_co], Reversible[_T_co], Generic[_T_co]):
|
||||
@overload
|
||||
@@ -308,14 +324,14 @@ class MutableSet(AbstractSet[_T], Generic[_T]):
|
||||
def __ixor__(self, s: AbstractSet[_S]) -> MutableSet[Union[_T, _S]]: ...
|
||||
def __isub__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ...
|
||||
|
||||
class MappingView(Sized):
|
||||
class MappingView:
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class ItemsView(AbstractSet[Tuple[_KT_co, _VT_co]], MappingView, Generic[_KT_co, _VT_co]):
|
||||
class ItemsView(MappingView, AbstractSet[Tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]):
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ...
|
||||
|
||||
class KeysView(AbstractSet[_KT_co], MappingView, Generic[_KT_co]):
|
||||
class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]):
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_KT_co]: ...
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from types import ModuleType, TracebackType
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_FT = TypeVar('_FT', bound=Callable[..., Any])
|
||||
_E = TypeVar('_E', bound=Exception)
|
||||
_E = TypeVar('_E', bound=BaseException)
|
||||
|
||||
|
||||
def expectedFailure(func: _FT) -> _FT: ...
|
||||
@@ -37,7 +37,7 @@ class TestCase:
|
||||
def setUpClass(cls) -> None: ...
|
||||
@classmethod
|
||||
def tearDownClass(cls) -> None: ...
|
||||
def run(self, result: Optional[TestResult] = ...) -> TestCase: ...
|
||||
def run(self, result: Optional[TestResult] = ...) -> Optional[TestResult]: ...
|
||||
def skipTest(self, reason: Any) -> None: ...
|
||||
def subTest(self, msg: Any = ..., **params: Any) -> ContextManager[None]: ...
|
||||
def debug(self) -> None: ...
|
||||
@@ -46,11 +46,10 @@ class TestCase:
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertTrue(self, expr: Any, msg: Any = ...) -> None: ...
|
||||
def assertFalse(self, expr: Any, msg: Any = ...) -> None: ...
|
||||
def assertIs(self, first: Any, second: Any, msg: Any = ...) -> None: ...
|
||||
def assertIsNot(self, first: Any, second: Any,
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertIsNone(self, expr: Any, msg: Any = ...) -> None: ...
|
||||
def assertIsNotNone(self, expr: Any, msg: Any = ...) -> None: ...
|
||||
def assertIs(self, expr1: Any, expr2: Any, msg: Any = ...) -> None: ...
|
||||
def assertIsNot(self, expr1: Any, expr2: Any, msg: Any = ...) -> None: ...
|
||||
def assertIsNone(self, obj: Any, msg: Any = ...) -> None: ...
|
||||
def assertIsNotNone(self, obj: Any, msg: Any = ...) -> None: ...
|
||||
def assertIn(self, member: Any,
|
||||
container: Union[Iterable[Any], Container[Any]],
|
||||
msg: Any = ...) -> None: ...
|
||||
@@ -63,48 +62,49 @@ class TestCase:
|
||||
def assertNotIsInstance(self, obj: Any,
|
||||
cls: Union[type, Tuple[type, ...]],
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertGreater(self, first: Any, second: Any,
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertGreaterEqual(self, first: Any, second: Any,
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertLess(self, first: Any, second: Any, msg: Any = ...) -> None: ...
|
||||
def assertLessEqual(self, first: Any, second: Any,
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertGreater(self, a: Any, b: Any, msg: Any = ...) -> None: ...
|
||||
def assertGreaterEqual(self, a: Any, b: Any, msg: Any = ...) -> None: ...
|
||||
def assertLess(self, a: Any, b: Any, msg: Any = ...) -> None: ...
|
||||
def assertLessEqual(self, a: Any, b: Any, msg: Any = ...) -> None: ...
|
||||
@overload
|
||||
def assertRaises(self, # type: ignore
|
||||
exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]],
|
||||
expected_exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]],
|
||||
callable: Callable[..., Any],
|
||||
*args: Any, **kwargs: Any) -> None: ...
|
||||
@overload
|
||||
def assertRaises(self,
|
||||
exception: Union[Type[_E], Tuple[Type[_E], ...]],
|
||||
expected_exception: Union[Type[_E], Tuple[Type[_E], ...]],
|
||||
msg: Any = ...) -> _AssertRaisesContext[_E]: ...
|
||||
@overload
|
||||
def assertRaisesRegex(self, # type: ignore
|
||||
exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]],
|
||||
expected_exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]],
|
||||
expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]],
|
||||
callable: Callable[..., Any],
|
||||
*args: Any, **kwargs: Any) -> None: ...
|
||||
@overload
|
||||
def assertRaisesRegex(self,
|
||||
exception: Union[Type[_E], Tuple[Type[_E], ...]],
|
||||
expected_exception: Union[Type[_E], Tuple[Type[_E], ...]],
|
||||
expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]],
|
||||
msg: Any = ...) -> _AssertRaisesContext[_E]: ...
|
||||
@overload
|
||||
def assertWarns(self, # type: ignore
|
||||
exception: Union[Type[Warning], Tuple[Type[Warning], ...]],
|
||||
expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]],
|
||||
callable: Callable[..., Any],
|
||||
*args: Any, **kwargs: Any) -> None: ...
|
||||
@overload
|
||||
def assertWarns(self,
|
||||
exception: Union[Type[Warning], Tuple[Type[Warning], ...]],
|
||||
expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]],
|
||||
msg: Any = ...) -> _AssertWarnsContext: ...
|
||||
@overload
|
||||
def assertWarnsRegex(self, # type: ignore
|
||||
exception: Union[Type[Warning], Tuple[Type[Warning], ...]],
|
||||
expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]],
|
||||
expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]],
|
||||
callable: Callable[..., Any],
|
||||
*args: Any, **kwargs: Any) -> None: ...
|
||||
@overload
|
||||
def assertWarnsRegex(self,
|
||||
exception: Union[Type[Warning], Tuple[Type[Warning], ...]],
|
||||
expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]],
|
||||
expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]],
|
||||
msg: Any = ...) -> _AssertWarnsContext: ...
|
||||
def assertLogs(
|
||||
self, logger: Optional[logging.Logger] = ...,
|
||||
@@ -112,12 +112,18 @@ class TestCase:
|
||||
) -> _AssertLogsContext: ...
|
||||
def assertAlmostEqual(self, first: float, second: float, places: int = ...,
|
||||
msg: Any = ..., delta: float = ...) -> None: ...
|
||||
@overload
|
||||
def assertNotAlmostEqual(self, first: float, second: float, *,
|
||||
msg: Any = ...) -> None: ...
|
||||
@overload
|
||||
def assertNotAlmostEqual(self, first: float, second: float,
|
||||
places: int = ..., msg: Any = ...,
|
||||
delta: float = ...) -> None: ...
|
||||
def assertRegex(self, text: AnyStr, regex: Union[AnyStr, Pattern[AnyStr]],
|
||||
places: int = ..., msg: Any = ...) -> None: ...
|
||||
@overload
|
||||
def assertNotAlmostEqual(self, first: float, second: float, *,
|
||||
msg: Any = ..., delta: float = ...) -> None: ...
|
||||
def assertRegex(self, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]],
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertNotRegex(self, text: AnyStr, regex: Union[AnyStr, Pattern[AnyStr]],
|
||||
def assertNotRegex(self, text: AnyStr, unexpected_regex: Union[AnyStr, Pattern[AnyStr]],
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertCountEqual(self, first: Iterable[Any], second: Iterable[Any],
|
||||
msg: Any = ...) -> None: ...
|
||||
@@ -125,16 +131,16 @@ class TestCase:
|
||||
function: Callable[..., None]) -> None: ...
|
||||
def assertMultiLineEqual(self, first: str, second: str,
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertSequenceEqual(self, first: Sequence[Any], second: Sequence[Any],
|
||||
def assertSequenceEqual(self, seq1: Sequence[Any], seq2: Sequence[Any],
|
||||
msg: Any = ...,
|
||||
seq_type: Type[Sequence[Any]] = ...) -> None: ...
|
||||
def assertListEqual(self, first: List[Any], second: List[Any],
|
||||
def assertListEqual(self, list1: List[Any], list2: List[Any],
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...],
|
||||
def assertTupleEqual(self, tuple1: Tuple[Any, ...], tuple2: Tuple[Any, ...],
|
||||
msg: Any = ...) -> None: ...
|
||||
def assertSetEqual(self, first: Union[Set[Any], FrozenSet[Any]],
|
||||
second: Union[Set[Any], FrozenSet[Any]], msg: Any = ...) -> None: ...
|
||||
def assertDictEqual(self, first: Dict[Any, Any], second: Dict[Any, Any],
|
||||
def assertSetEqual(self, set1: Union[Set[Any], FrozenSet[Any]],
|
||||
set2: Union[Set[Any], FrozenSet[Any]], msg: Any = ...) -> None: ...
|
||||
def assertDictEqual(self, d1: Dict[Any, Any], d2: Dict[Any, Any],
|
||||
msg: Any = ...) -> None: ...
|
||||
def fail(self, msg: Any = ...) -> NoReturn: ...
|
||||
def countTestCases(self) -> int: ...
|
||||
@@ -281,8 +287,13 @@ class TestResult:
|
||||
outcome: Optional[_SysExcInfoType]) -> None: ...
|
||||
|
||||
class TextTestResult(TestResult):
|
||||
separator1: str
|
||||
separator2: str
|
||||
def __init__(self, stream: TextIO, descriptions: bool,
|
||||
verbosity: int) -> None: ...
|
||||
def getDescription(self, test: TestCase) -> str: ...
|
||||
def printErrors(self) -> None: ...
|
||||
def printErrorList(self, flavour: str, errors: Tuple[TestCase, str]) -> None: ...
|
||||
_TextTestResult = TextTestResult
|
||||
|
||||
defaultTestLoader = ... # type: TestLoader
|
||||
|
||||
@@ -82,14 +82,14 @@ class _patch_dict:
|
||||
stop = ... # type: Any
|
||||
|
||||
class _patcher:
|
||||
TEST_PREFIX = ... # type: str
|
||||
dict = ... # type: Type[_patch_dict]
|
||||
def __call__(self, target: Any, new: Optional[Any] = ..., spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> Any: ...
|
||||
TEST_PREFIX: str
|
||||
dict: Type[_patch_dict]
|
||||
def __call__(self, target: Any, new: Optional[Any] = ..., spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ...
|
||||
def object(self, target: Any, attribute: Text, new: Optional[Any] = ..., spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ...
|
||||
def multiple(self, target: Any, spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> Any: ...
|
||||
def multiple(self, target: Any, spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ...
|
||||
def stopall(self) -> None: ...
|
||||
|
||||
patch = ... # type: _patcher
|
||||
patch: _patcher
|
||||
|
||||
class MagicMixin:
|
||||
def __init__(self, *args: Any, **kw: Any) -> None: ...
|
||||
|
||||
@@ -7,14 +7,12 @@ import os
|
||||
import filecmp
|
||||
|
||||
consistent_files = [
|
||||
{'stdlib/2/builtins.pyi', 'stdlib/2/__builtin__.pyi'},
|
||||
{'stdlib/2and3/builtins.pyi', 'stdlib/2/__builtin__.pyi'},
|
||||
{'stdlib/2/SocketServer.pyi', 'stdlib/3/socketserver.pyi'},
|
||||
{'stdlib/2/os2emxpath.pyi', 'stdlib/2/posixpath.pyi', 'stdlib/2/ntpath.pyi', 'stdlib/2/macpath.pyi'},
|
||||
{'stdlib/2and3/pyexpat/__init__.pyi', 'stdlib/2and3/xml/parsers/expat/__init__.pyi'},
|
||||
{'stdlib/2and3/pyexpat/errors.pyi', 'stdlib/2and3/xml/parsers/expat/errors.pyi'},
|
||||
{'stdlib/2and3/pyexpat/model.pyi', 'stdlib/2and3/xml/parsers/expat/model.pyi'},
|
||||
{'stdlib/3/ntpath.pyi', 'stdlib/3/posixpath.pyi', 'stdlib/3/macpath.pyi', 'stdlib/3/posixpath.pyi'},
|
||||
{'stdlib/3/enum.pyi', 'third_party/3/enum.pyi'},
|
||||
{'stdlib/2/os2emxpath.pyi', 'stdlib/2and3/posixpath.pyi',
|
||||
'stdlib/2and3/ntpath.pyi', 'stdlib/2and3/macpath.pyi',
|
||||
'stdlib/2/os/path.pyi', 'stdlib/3/os/path.pyi'},
|
||||
{'stdlib/3/enum.pyi', 'third_party/2/enum.pyi'},
|
||||
{'stdlib/2/os/path.pyi', 'stdlib/3/os/path.pyi'},
|
||||
{'stdlib/3/unittest/mock.pyi', 'third_party/2and3/mock.pyi'},
|
||||
{'stdlib/3/concurrent/__init__.pyi', 'third_party/2/concurrent/__init__.pyi'},
|
||||
|
||||
@@ -3,15 +3,11 @@
|
||||
# pytype has its own version of these files, and thus doesn't mind if it
|
||||
# can't parse the typeshed version:
|
||||
stdlib/2/__builtin__.pyi
|
||||
stdlib/2/builtins.pyi
|
||||
stdlib/2/typing.pyi
|
||||
stdlib/3/builtins.pyi
|
||||
stdlib/2and3/builtins.pyi
|
||||
stdlib/3/typing.pyi
|
||||
stdlib/3/collections/__init__.pyi # parse only
|
||||
|
||||
# builtins not found
|
||||
stdlib/2/os/__init__.pyi # parse only
|
||||
|
||||
# pytype doesn't yet support aliases with implicit type parameters
|
||||
# (e.g., here, FutureT = Future[T])
|
||||
stdlib/3/asyncio/tasks.pyi
|
||||
|
||||
@@ -274,7 +274,7 @@ def pytype_test(args):
|
||||
# We strip off the stack trace and just leave the last line with the
|
||||
# actual error; to see the stack traces use --print_stderr.
|
||||
bad.append((_get_relative(test_run.args[-1]),
|
||||
stderr.rstrip().rsplit('\n', 1)[-1]))
|
||||
stderr.rstrip().rsplit(b'\n', 1)[-1]))
|
||||
|
||||
if runs % 25 == 0:
|
||||
print(" %3d/%d with %3d errors" % (runs, total_tests, errors))
|
||||
|
||||
+9
-4
@@ -5,7 +5,7 @@ from __future__ import print_function
|
||||
import types
|
||||
from typing import (
|
||||
Any, AnyStr, Callable, Dict, Iterable, Mapping, NoReturn, Optional,
|
||||
Pattern, Tuple, Type, TypeVar, Union, overload, ValuesView, KeysView, ItemsView
|
||||
Pattern, Text, Tuple, Type, TypeVar, Union, overload, ValuesView, KeysView, ItemsView,
|
||||
)
|
||||
import typing
|
||||
import unittest
|
||||
@@ -78,14 +78,19 @@ def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Itera
|
||||
def assertRaisesRegex(self: unittest.TestCase, msg: str = ...) -> Any: ...
|
||||
@overload
|
||||
def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
|
||||
def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: str = ...) -> None: ...
|
||||
def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]],
|
||||
msg: str = ...) -> None: ...
|
||||
|
||||
def reraise(tp: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType] = ...) -> NoReturn: ...
|
||||
def reraise(tp: Optional[Type[BaseException]], value: Optional[BaseException],
|
||||
tb: Optional[types.TracebackType] = ...) -> NoReturn: ...
|
||||
def exec_(_code_: Union[unicode, types.CodeType], _globs_: Dict[str, Any] = ..., _locs_: Dict[str, Any] = ...): ...
|
||||
def raise_from(value: BaseException, from_value: Optional[BaseException]) -> NoReturn: ...
|
||||
def raise_from(value: Union[BaseException, Type[BaseException]], from_value: Optional[BaseException]) -> NoReturn: ...
|
||||
|
||||
print_ = print
|
||||
|
||||
def with_metaclass(meta: type, *bases: type) -> type: ...
|
||||
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
|
||||
def ensure_binary(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> bytes: ...
|
||||
def ensure_str(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> str: ...
|
||||
def ensure_text(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> Text: ...
|
||||
def python_2_unicode_compatible(klass: _T) -> _T: ...
|
||||
|
||||
+165
-125
@@ -1,16 +1,31 @@
|
||||
from typing import Any, Callable, Dict, Generic, List, Optional, Sequence, Mapping, Tuple, Type, TypeVar, Union, overload
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Generic,
|
||||
List,
|
||||
Optional,
|
||||
Sequence,
|
||||
Mapping,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
|
||||
# `import X as X` is required to make these public
|
||||
from . import exceptions as exceptions
|
||||
from . import filters as filters
|
||||
from . import converters as converters
|
||||
from . import validators as validators
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_C = TypeVar('_C', bound=type)
|
||||
_T = TypeVar("_T")
|
||||
_C = TypeVar("_C", bound=type)
|
||||
|
||||
_ValidatorType = Callable[[Any, Attribute, _T], Any]
|
||||
_ValidatorType = Callable[[Any, Attribute[_T], _T], Any]
|
||||
_ConverterType = Callable[[Any], _T]
|
||||
_FilterType = Callable[[Attribute, Any], bool]
|
||||
_FilterType = Callable[[Attribute[_T], _T], bool]
|
||||
# FIXME: in reality, if multiple validators are passed they must be in a list or tuple,
|
||||
# but those are invariant and so would prevent subtypes of _ValidatorType from working
|
||||
# when passed in a list or tuple.
|
||||
@@ -25,7 +40,10 @@ NOTHING: object
|
||||
@overload
|
||||
def Factory(factory: Callable[[], _T]) -> _T: ...
|
||||
@overload
|
||||
def Factory(factory: Union[Callable[[Any], _T], Callable[[], _T]], takes_self: bool = ...) -> _T: ...
|
||||
def Factory(
|
||||
factory: Union[Callable[[Any], _T], Callable[[], _T]],
|
||||
takes_self: bool = ...,
|
||||
) -> _T: ...
|
||||
|
||||
class Attribute(Generic[_T]):
|
||||
name: str
|
||||
@@ -38,30 +56,26 @@ class Attribute(Generic[_T]):
|
||||
converter: Optional[_ConverterType[_T]]
|
||||
metadata: Dict[Any, Any]
|
||||
type: Optional[Type[_T]]
|
||||
def __lt__(self, x: Attribute) -> bool: ...
|
||||
def __le__(self, x: Attribute) -> bool: ...
|
||||
def __gt__(self, x: Attribute) -> bool: ...
|
||||
def __ge__(self, x: Attribute) -> bool: ...
|
||||
|
||||
kw_only: bool
|
||||
def __lt__(self, x: Attribute[_T]) -> bool: ...
|
||||
def __le__(self, x: Attribute[_T]) -> bool: ...
|
||||
def __gt__(self, x: Attribute[_T]) -> bool: ...
|
||||
def __ge__(self, x: Attribute[_T]) -> bool: ...
|
||||
|
||||
# NOTE: We had several choices for the annotation to use for type arg:
|
||||
# 1) Type[_T]
|
||||
# - Pros: works in PyCharm without plugin support
|
||||
# - Cons: produces less informative error in the case of conflicting TypeVars
|
||||
# e.g. `attr.ib(default='bad', type=int)`
|
||||
# - Pros: Handles simple cases correctly
|
||||
# - Cons: Might produce less informative errors in the case of conflicting TypeVars
|
||||
# e.g. `attr.ib(default='bad', type=int)`
|
||||
# 2) Callable[..., _T]
|
||||
# - Pros: more informative errors than #1
|
||||
# - Cons: validator tests results in confusing error.
|
||||
# e.g. `attr.ib(type=int, validator=validate_str)`
|
||||
# - Pros: Better error messages than #1 for conflicting TypeVars
|
||||
# - Cons: Terrible error messages for validator checks.
|
||||
# e.g. attr.ib(type=int, validator=validate_str)
|
||||
# -> error: Cannot infer function type argument
|
||||
# 3) type (and do all of the work in the mypy plugin)
|
||||
# - Pros: in mypy, the behavior of type argument is exactly the same as with
|
||||
# annotations.
|
||||
# - Cons: completely disables type inspections in PyCharm when using the
|
||||
# type arg.
|
||||
# We chose option #1 until either PyCharm adds support for attrs, or python 2
|
||||
# reaches EOL.
|
||||
|
||||
# NOTE: If you update these, update `ib` and `attr` below.
|
||||
# - Pros: Simple here, and we could customize the plugin with our own errors.
|
||||
# - Cons: Would need to write mypy plugin code to handle all the cases.
|
||||
# We chose option #1.
|
||||
|
||||
# `attr` lies about its return type to make the following possible:
|
||||
# attr() -> Any
|
||||
@@ -72,111 +86,133 @@ class Attribute(Generic[_T]):
|
||||
#
|
||||
# This form catches explicit None or no default but with no other arguments returns Any.
|
||||
@overload
|
||||
def attrib(default: None = ...,
|
||||
validator: None = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
convert: None = ...,
|
||||
metadata: Optional[Mapping[Any, Any]] = ...,
|
||||
type: None = ...,
|
||||
converter: None = ...,
|
||||
factory: None = ...,
|
||||
) -> Any: ...
|
||||
def attrib(
|
||||
default: None = ...,
|
||||
validator: None = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
convert: None = ...,
|
||||
metadata: Optional[Mapping[Any, Any]] = ...,
|
||||
type: None = ...,
|
||||
converter: None = ...,
|
||||
factory: None = ...,
|
||||
kw_only: bool = ...,
|
||||
) -> Any: ...
|
||||
|
||||
# This form catches an explicit None or no default and infers the type from the other arguments.
|
||||
@overload
|
||||
def attrib(default: None = ...,
|
||||
validator: Optional[_ValidatorArgType[_T]] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
convert: Optional[_ConverterType[_T]] = ...,
|
||||
metadata: Optional[Mapping[Any, Any]] = ...,
|
||||
type: Optional[Type[_T]] = ...,
|
||||
converter: Optional[_ConverterType[_T]] = ...,
|
||||
factory: Optional[Callable[[], _T]] = ...,
|
||||
) -> _T: ...
|
||||
def attrib(
|
||||
default: None = ...,
|
||||
validator: Optional[_ValidatorArgType[_T]] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
convert: Optional[_ConverterType[_T]] = ...,
|
||||
metadata: Optional[Mapping[Any, Any]] = ...,
|
||||
type: Optional[Type[_T]] = ...,
|
||||
converter: Optional[_ConverterType[_T]] = ...,
|
||||
factory: Optional[Callable[[], _T]] = ...,
|
||||
kw_only: bool = ...,
|
||||
) -> _T: ...
|
||||
|
||||
# This form catches an explicit default argument.
|
||||
@overload
|
||||
def attrib(default: _T,
|
||||
validator: Optional[_ValidatorArgType[_T]] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
convert: Optional[_ConverterType[_T]] = ...,
|
||||
metadata: Optional[Mapping[Any, Any]] = ...,
|
||||
type: Optional[Type[_T]] = ...,
|
||||
converter: Optional[_ConverterType[_T]] = ...,
|
||||
factory: Optional[Callable[[], _T]] = ...,
|
||||
) -> _T: ...
|
||||
def attrib(
|
||||
default: _T,
|
||||
validator: Optional[_ValidatorArgType[_T]] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
convert: Optional[_ConverterType[_T]] = ...,
|
||||
metadata: Optional[Mapping[Any, Any]] = ...,
|
||||
type: Optional[Type[_T]] = ...,
|
||||
converter: Optional[_ConverterType[_T]] = ...,
|
||||
factory: Optional[Callable[[], _T]] = ...,
|
||||
kw_only: bool = ...,
|
||||
) -> _T: ...
|
||||
|
||||
# This form covers type=non-Type: e.g. forward references (str), Any
|
||||
@overload
|
||||
def attrib(default: Optional[_T] = ...,
|
||||
validator: Optional[_ValidatorArgType[_T]] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
convert: Optional[_ConverterType[_T]] = ...,
|
||||
metadata: Optional[Mapping[Any, Any]] = ...,
|
||||
type: object = ...,
|
||||
converter: Optional[_ConverterType[_T]] = ...,
|
||||
factory: Optional[Callable[[], _T]] = ...,
|
||||
) -> Any: ...
|
||||
|
||||
|
||||
# NOTE: If you update these, update `s` and `attributes` below.
|
||||
def attrib(
|
||||
default: Optional[_T] = ...,
|
||||
validator: Optional[_ValidatorArgType[_T]] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
convert: Optional[_ConverterType[_T]] = ...,
|
||||
metadata: Optional[Mapping[Any, Any]] = ...,
|
||||
type: object = ...,
|
||||
converter: Optional[_ConverterType[_T]] = ...,
|
||||
factory: Optional[Callable[[], _T]] = ...,
|
||||
kw_only: bool = ...,
|
||||
) -> Any: ...
|
||||
@overload
|
||||
def attrs(maybe_cls: _C,
|
||||
these: Optional[Dict[str, Any]] = ...,
|
||||
repr_ns: Optional[str] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
slots: bool = ...,
|
||||
frozen: bool = ...,
|
||||
str: bool = ...,
|
||||
auto_attribs: bool = ...) -> _C: ...
|
||||
def attrs(
|
||||
maybe_cls: _C,
|
||||
these: Optional[Dict[str, Any]] = ...,
|
||||
repr_ns: Optional[str] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
slots: bool = ...,
|
||||
frozen: bool = ...,
|
||||
weakref_slot: bool = ...,
|
||||
str: bool = ...,
|
||||
auto_attribs: bool = ...,
|
||||
kw_only: bool = ...,
|
||||
cache_hash: bool = ...,
|
||||
) -> _C: ...
|
||||
@overload
|
||||
def attrs(maybe_cls: None = ...,
|
||||
these: Optional[Dict[str, Any]] = ...,
|
||||
repr_ns: Optional[str] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
slots: bool = ...,
|
||||
frozen: bool = ...,
|
||||
str: bool = ...,
|
||||
auto_attribs: bool = ...) -> Callable[[_C], _C]: ...
|
||||
|
||||
def attrs(
|
||||
maybe_cls: None = ...,
|
||||
these: Optional[Dict[str, Any]] = ...,
|
||||
repr_ns: Optional[str] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
slots: bool = ...,
|
||||
frozen: bool = ...,
|
||||
weakref_slot: bool = ...,
|
||||
str: bool = ...,
|
||||
auto_attribs: bool = ...,
|
||||
kw_only: bool = ...,
|
||||
cache_hash: bool = ...,
|
||||
) -> Callable[[_C], _C]: ...
|
||||
|
||||
# TODO: add support for returning NamedTuple from the mypy plugin
|
||||
class _Fields(Tuple[Attribute, ...]):
|
||||
def __getattr__(self, name: str) -> Attribute: ...
|
||||
class _Fields(Tuple[Attribute[Any], ...]):
|
||||
def __getattr__(self, name: str) -> Attribute[Any]: ...
|
||||
|
||||
def fields(cls: type) -> _Fields: ...
|
||||
def fields_dict(cls: type) -> Dict[str, Attribute]: ...
|
||||
def fields_dict(cls: type) -> Dict[str, Attribute[Any]]: ...
|
||||
def validate(inst: Any) -> None: ...
|
||||
|
||||
# TODO: add support for returning a proper attrs class from the mypy plugin
|
||||
# we use Any instead of _CountingAttr so that e.g. `make_class('Foo', [attr.ib()])` is valid
|
||||
def make_class(name: str,
|
||||
attrs: Union[List[str], Tuple[str, ...], Dict[str, Any]],
|
||||
bases: Tuple[type, ...] = ...,
|
||||
repr_ns: Optional[str] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
slots: bool = ...,
|
||||
frozen: bool = ...,
|
||||
str: bool = ...,
|
||||
auto_attribs: bool = ...) -> type: ...
|
||||
def make_class(
|
||||
name: str,
|
||||
attrs: Union[List[str], Tuple[str, ...], Dict[str, Any]],
|
||||
bases: Tuple[type, ...] = ...,
|
||||
repr_ns: Optional[str] = ...,
|
||||
repr: bool = ...,
|
||||
cmp: bool = ...,
|
||||
hash: Optional[bool] = ...,
|
||||
init: bool = ...,
|
||||
slots: bool = ...,
|
||||
frozen: bool = ...,
|
||||
weakref_slot: bool = ...,
|
||||
str: bool = ...,
|
||||
auto_attribs: bool = ...,
|
||||
kw_only: bool = ...,
|
||||
cache_hash: bool = ...,
|
||||
) -> type: ...
|
||||
|
||||
# _funcs --
|
||||
|
||||
@@ -184,17 +220,22 @@ def make_class(name: str,
|
||||
# FIXME: asdict/astuple do not honor their factory args. waiting on one of these:
|
||||
# https://github.com/python/mypy/issues/4236
|
||||
# https://github.com/python/typing/issues/253
|
||||
def asdict(inst: Any,
|
||||
recurse: bool = ...,
|
||||
filter: Optional[_FilterType] = ...,
|
||||
dict_factory: Type[Mapping[Any, Any]] = ...,
|
||||
retain_collection_types: bool = ...) -> Dict[str, Any]: ...
|
||||
def asdict(
|
||||
inst: Any,
|
||||
recurse: bool = ...,
|
||||
filter: Optional[_FilterType[Any]] = ...,
|
||||
dict_factory: Type[Mapping[Any, Any]] = ...,
|
||||
retain_collection_types: bool = ...,
|
||||
) -> Dict[str, Any]: ...
|
||||
|
||||
# TODO: add support for returning NamedTuple from the mypy plugin
|
||||
def astuple(inst: Any,
|
||||
recurse: bool = ...,
|
||||
filter: Optional[_FilterType] = ...,
|
||||
tuple_factory: Type[Sequence] = ...,
|
||||
retain_collection_types: bool = ...) -> Tuple[Any, ...]: ...
|
||||
def astuple(
|
||||
inst: Any,
|
||||
recurse: bool = ...,
|
||||
filter: Optional[_FilterType[Any]] = ...,
|
||||
tuple_factory: Type[Sequence[Any]] = ...,
|
||||
retain_collection_types: bool = ...,
|
||||
) -> Tuple[Any, ...]: ...
|
||||
def has(cls: type) -> bool: ...
|
||||
def assoc(inst: _T, **changes: Any) -> _T: ...
|
||||
def evolve(inst: _T, **changes: Any) -> _T: ...
|
||||
@@ -204,7 +245,6 @@ def evolve(inst: _T, **changes: Any) -> _T: ...
|
||||
def set_run_validators(run: bool) -> None: ...
|
||||
def get_run_validators() -> bool: ...
|
||||
|
||||
|
||||
# aliases --
|
||||
|
||||
s = attributes = attrs
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
from typing import TypeVar, Optional
|
||||
from typing import TypeVar, Optional, Callable, overload
|
||||
from . import _ConverterType
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def optional(converter: _ConverterType[_T]) -> _ConverterType[Optional[_T]]: ...
|
||||
def optional(
|
||||
converter: _ConverterType[_T]
|
||||
) -> _ConverterType[Optional[_T]]: ...
|
||||
@overload
|
||||
def default_if_none(default: _T) -> _ConverterType[_T]: ...
|
||||
@overload
|
||||
def default_if_none(*, factory: Callable[[], _T]) -> _ConverterType[_T]: ...
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class FrozenInstanceError(AttributeError):
|
||||
msg: str = ...
|
||||
|
||||
class AttrsAttributeNotFoundError(ValueError): ...
|
||||
class NotAnAttrsClassError(ValueError): ...
|
||||
class DefaultAlreadySetError(RuntimeError): ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from typing import Union
|
||||
from typing import Union, Any
|
||||
from . import Attribute, _FilterType
|
||||
|
||||
def include(*what: Union[type, Attribute]) -> _FilterType: ...
|
||||
def exclude(*what: Union[type, Attribute]) -> _FilterType: ...
|
||||
def include(*what: Union[type, Attribute[Any]]) -> _FilterType[Any]: ...
|
||||
def exclude(*what: Union[type, Attribute[Any]]) -> _FilterType[Any]: ...
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
from typing import Container, List, Union, TypeVar, Type, Any, Optional, Tuple
|
||||
from . import _ValidatorType
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def instance_of(type: Union[Tuple[Type[_T], ...], Type[_T]]) -> _ValidatorType[_T]: ...
|
||||
def instance_of(
|
||||
type: Union[Tuple[Type[_T], ...], Type[_T]]
|
||||
) -> _ValidatorType[_T]: ...
|
||||
def provides(interface: Any) -> _ValidatorType[Any]: ...
|
||||
def optional(validator: Union[_ValidatorType[_T], List[_ValidatorType[_T]]]) -> _ValidatorType[Optional[_T]]: ...
|
||||
def optional(
|
||||
validator: Union[_ValidatorType[_T], List[_ValidatorType[_T]]]
|
||||
) -> _ValidatorType[Optional[_T]]: ...
|
||||
def in_(options: Container[_T]) -> _ValidatorType[_T]: ...
|
||||
def and_(*validators: _ValidatorType[_T]) -> _ValidatorType[_T]: ...
|
||||
def deep_iterable(
|
||||
member_validator: _ValidatorType[_T],
|
||||
iterable_validator: Optional[_ValidatorType[_T]],
|
||||
) -> _ValidatorType[_T]: ...
|
||||
def deep_mapping(
|
||||
key_validator: _ValidatorType[_T],
|
||||
value_validator: _ValidatorType[_T],
|
||||
mapping_validator: Optional[_ValidatorType[_T]],
|
||||
) -> _ValidatorType[_T]: ...
|
||||
def is_callable() -> _ValidatorType[_T]: ...
|
||||
|
||||
+5
-5
@@ -82,14 +82,14 @@ class _patch_dict:
|
||||
stop = ... # type: Any
|
||||
|
||||
class _patcher:
|
||||
TEST_PREFIX = ... # type: str
|
||||
dict = ... # type: Type[_patch_dict]
|
||||
def __call__(self, target: Any, new: Optional[Any] = ..., spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> Any: ...
|
||||
TEST_PREFIX: str
|
||||
dict: Type[_patch_dict]
|
||||
def __call__(self, target: Any, new: Optional[Any] = ..., spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ...
|
||||
def object(self, target: Any, attribute: Text, new: Optional[Any] = ..., spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ...
|
||||
def multiple(self, target: Any, spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> Any: ...
|
||||
def multiple(self, target: Any, spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ...
|
||||
def stopall(self) -> None: ...
|
||||
|
||||
patch = ... # type: _patcher
|
||||
patch: _patcher
|
||||
|
||||
class MagicMixin:
|
||||
def __init__(self, *args: Any, **kw: Any) -> None: ...
|
||||
|
||||
+5
-1
@@ -14,6 +14,7 @@ from typing import (
|
||||
NoReturn,
|
||||
Optional,
|
||||
Pattern,
|
||||
Text,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
@@ -95,10 +96,13 @@ def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[Any
|
||||
exec_ = exec
|
||||
|
||||
def reraise(tp: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType] = ...) -> NoReturn: ...
|
||||
def raise_from(value: BaseException, from_value: Optional[BaseException]) -> NoReturn: ...
|
||||
def raise_from(value: Union[BaseException, Type[BaseException]], from_value: Optional[BaseException]) -> NoReturn: ...
|
||||
|
||||
print_ = print
|
||||
|
||||
def with_metaclass(meta: type, *bases: type) -> type: ...
|
||||
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
|
||||
def ensure_binary(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> bytes: ...
|
||||
def ensure_str(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> str: ...
|
||||
def ensure_text(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> Text: ...
|
||||
def python_2_unicode_compatible(klass: _T) -> _T: ...
|
||||
|
||||
@@ -37,6 +37,9 @@ class PyStdlibInspectionExtension : PyInspectionExtension() {
|
||||
}
|
||||
|
||||
override fun ignoreMethodParameters(function: PyFunction, context: TypeEvalContext): Boolean {
|
||||
return function.name == DUNDER_POST_INIT && function.containingClass?.let { parseStdDataclassParameters(it, context) != null } == true
|
||||
return function.name == "__prepare__" &&
|
||||
function.getParameters(context).let { it.size == 3 && !it.any { p -> p.isKeywordContainer || p.isPositionalContainer } } ||
|
||||
function.name == DUNDER_POST_INIT &&
|
||||
function.containingClass?.let { parseStdDataclassParameters(it, context) != null } == true
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import com.jetbrains.python.psi.impl.PyTypeProvider;
|
||||
import com.jetbrains.python.psi.resolve.PyResolveContext;
|
||||
import com.jetbrains.python.psi.resolve.RatedResolveResult;
|
||||
import com.jetbrains.python.pyi.PyiFile;
|
||||
import com.jetbrains.python.sdk.PythonSdkType;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -840,7 +841,7 @@ public class PyTypeChecker {
|
||||
final PsiFile subClassFile = subClass.getContainingFile();
|
||||
|
||||
final boolean isPy2 = subClassFile instanceof PyiFile
|
||||
? PyBuiltinCache.getInstance(subClass).getObjectType(PyNames.TYPE_UNICODE) != null
|
||||
? PythonSdkType.getLanguageLevelForSdk(PythonSdkType.findPythonSdk(subClassFile)).isPython2()
|
||||
: LanguageLevel.forElement(subClass).isPython2();
|
||||
|
||||
final String superClassName = superClass.getName();
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
print(dict.fromkeys(<warning descr="Parameter(s) unfilledPossible callees:dict.fromkeys(seq: Sequence[_T])dict.fromkeys(seq: Sequence[_T], value: _S)">)</warning>)
|
||||
print(dict.fromkeys(<warning descr="Parameter(s) unfilledPossible callees:dict.fromkeys(seq: Iterable[_T])dict.fromkeys(seq: Iterable[_T], value: _S)">)</warning>)
|
||||
print(dict.fromkeys(['foo', 'bar']))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class MyType1(type):
|
||||
@classmethod
|
||||
def __prepare__(metacls, name):
|
||||
def __prepare__<warning descr="Signature of method 'MyType1.__prepare__()' does not match signature of base method in class 'type'">(metacls, name)</warning>:
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@ def test():
|
||||
float(False)
|
||||
complex(False)
|
||||
divmod(False, False)
|
||||
divmod<warning descr="Unexpected type(s):(str, unicode)Possible types:(float, float)(int, int)">('foo', u'bar')</warning>
|
||||
divmod(<warning descr="Expected type '_N2', got 'str' instead">'foo'</warning>, <warning descr="Expected type '_N2', got 'unicode' instead">u'bar'</warning>)
|
||||
pow(False, True)
|
||||
round<warning descr="Unexpected type(s):(bool, str)Possible types:(SupportsRound, int)(float, int)">(False, 'foo')</warning>
|
||||
|
||||
@@ -11,6 +11,6 @@ def test_numerics():
|
||||
float(False)
|
||||
complex(False)
|
||||
divmod(False, False)
|
||||
divmod(<warning descr="Expected type '_N', got 'bytes' instead">b'foo'</warning>, <warning descr="Expected type '_N', got 'str' instead">'bar'</warning>)
|
||||
divmod(<warning descr="Expected type '_N2', got 'bytes' instead">b'foo'</warning>, <warning descr="Expected type '_N2', got 'str' instead">'bar'</warning>)
|
||||
pow(False, True)
|
||||
round<warning descr="Unexpected type(s):(bool, str)Possible types:(SupportsRound[int], int)(SupportsRound[int], None)(float, int)(float, None)">(False, 'foo')</warning>
|
||||
|
||||
@@ -5,4 +5,4 @@ T = TypeVar("T")
|
||||
|
||||
def foo(values: Dict[T, Iterable[Any]]):
|
||||
for e in []:
|
||||
values.setdefault(e, None)
|
||||
values.setdefault(e, undefined)
|
||||
@@ -69,6 +69,7 @@ public class PyStructureViewTest extends PyTestCase {
|
||||
" f(self, x)\n" +
|
||||
" __str__(self)\n" +
|
||||
" x\n" +
|
||||
" __class__(self)\n" +
|
||||
" __init__(self)\n" +
|
||||
" __new__(cls)\n" +
|
||||
" __setattr__(self, name, value)\n" +
|
||||
@@ -82,7 +83,6 @@ public class PyStructureViewTest extends PyTestCase {
|
||||
" __sizeof__(self)\n" +
|
||||
" __reduce__(self)\n" +
|
||||
" __reduce_ex__(self, protocol)\n" +
|
||||
" __class__\n" +
|
||||
" __dict__\n" +
|
||||
" __doc__\n" +
|
||||
" __module__\n" +
|
||||
@@ -111,6 +111,7 @@ public class PyStructureViewTest extends PyTestCase {
|
||||
doTest("-parentImportedWithAs.py\n" +
|
||||
" -CLS(P)\n" +
|
||||
" foo(self)\n" +
|
||||
" __class__(self)\n" +
|
||||
" __init__(self)\n" +
|
||||
" __new__(cls)\n" +
|
||||
" __setattr__(self, name, value)\n" +
|
||||
@@ -125,7 +126,6 @@ public class PyStructureViewTest extends PyTestCase {
|
||||
" __sizeof__(self)\n" +
|
||||
" __reduce__(self)\n" +
|
||||
" __reduce_ex__(self, protocol)\n" +
|
||||
" __class__\n" +
|
||||
" __dict__\n" +
|
||||
" __doc__\n" +
|
||||
" __module__\n" +
|
||||
|
||||
Reference in New Issue
Block a user