mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Sync with typeshed @ b8f7ba8e8a92677400f878889582abe39c6050b4
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
# Some PEP8 deviations are considered irrelevant to stub files:
|
||||
# (error counts as of 2016-12-19)
|
||||
# 17381 E704 multiple statements on one line (def)
|
||||
# 11840 E301 expected 1 blank line
|
||||
# 7467 E302 expected 2 blank lines
|
||||
# 1772 E501 line too long
|
||||
# 1487 F401 imported but unused
|
||||
# 1248 E701 multiple statements on one line (colon)
|
||||
# 427 F811 redefinition
|
||||
# 356 E305 expected 2 blank lines
|
||||
# (error counts as of 2017-05-22)
|
||||
# 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
|
||||
# 390 E305 expected 2 blank lines
|
||||
|
||||
# Nice-to-haves ignored for now
|
||||
# 152 E128 continuation line under-indented for visual indent
|
||||
# 43 E127 continuation line over-indented for visual indent
|
||||
# 159 E128 continuation line under-indented for visual indent
|
||||
# 34 E127 continuation line over-indented for visual indent
|
||||
|
||||
[flake8]
|
||||
ignore = F401, F811, E127, E128, E301, E302, E305, E501, E701, E704, B303
|
||||
ignore = F401, F403, F405, F811, E127, E128, E301, E302, E305, E501, E701, E704, B303
|
||||
# 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*,@*
|
||||
|
||||
@@ -61,3 +61,7 @@ analyze.py
|
||||
.*.sw?
|
||||
.vscode/
|
||||
.idea/
|
||||
.venv*/
|
||||
|
||||
# Mypy cache
|
||||
.mypy_cache/
|
||||
|
||||
@@ -5,13 +5,15 @@ matrix:
|
||||
include:
|
||||
- python: "3.6-dev"
|
||||
env: TEST_CMD="flake8"
|
||||
- python: "3.6"
|
||||
env: TEST_CMD="./tests/mypy_selftest.py"
|
||||
- python: "3.5"
|
||||
env: TEST_CMD="./tests/mypy_test.py"
|
||||
env: TEST_CMD="./tests/mypy_test.py --no-implicit-optional"
|
||||
- python: "2.7"
|
||||
env: TEST_CMD="./tests/pytype_test.py --num-parallel=4"
|
||||
|
||||
install:
|
||||
# pytype needs py-2.7, mypy needs py-3.2+. Additional logic in runtests.py
|
||||
# pytype needs py-2.7, mypy needs py-3.3+. Additional logic in runtests.py
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == '3.6-dev' ]]; then pip install -U flake8==3.3.0 flake8-bugbear>=17.3.0 flake8-pyi>=17.1.0; 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 [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install -U git+git://github.com/google/pytype; fi
|
||||
|
||||
@@ -9,12 +9,12 @@ are important to the project's success.
|
||||
## The contribution process at a glance
|
||||
|
||||
1. Read the [README.md file](README.md).
|
||||
2. Set up your environment to be able to run all tests with `runtests.sh`. They should pass.
|
||||
2. Set up your environment to be able to [run all tests](README.md#running-the-tests). They should pass.
|
||||
3. [Prepare your changes](#preparing-changes):
|
||||
* [Contact us](#discussion) before starting significant work.
|
||||
* IMPORTANT: For new libraries, [get permission from the library owner first](#adding-a-new-library).
|
||||
* Create your stubs [conforming to the coding style](#stub-file-coding-style).
|
||||
* Make sure `runtests.sh` passes cleanly on Mypy, pytype, and flake8.
|
||||
* Make sure your tests pass cleanly on `mypy`, `pytype`, and `flake8`.
|
||||
4. [Submit your changes](#submitting-changes):
|
||||
* Open a pull request
|
||||
* For new libraries, [include a reference to where you got permission](#adding-a-new-library)
|
||||
@@ -37,8 +37,8 @@ tracker](https://github.com/python/typeshed/issues). This is the right
|
||||
place to start a discussion of any of the above or most any other
|
||||
topic concerning the project.
|
||||
|
||||
For less formal discussion, try the Mypy chat room on
|
||||
[gitter.im](https://gitter.im/python/mypy). Some Mypy core developers
|
||||
For less formal discussion, try the typing chat room on
|
||||
[gitter.im](https://gitter.im/python/typing). Some Mypy core developers
|
||||
are almost always present; feel free to find us there and we're happy
|
||||
to chat. Substantive technical discussion will be directed to the
|
||||
issue tracker.
|
||||
@@ -69,6 +69,12 @@ For every pull request, we aim to promptly either merge it or say why
|
||||
it's not yet ready; if you go a few days without a reply, please feel
|
||||
free to ping the thread by adding a new comment.
|
||||
|
||||
To get your pull request merged sooner, you should explain why you are
|
||||
making the change. For example, you can point to a code sample that is
|
||||
processed incorrectly by a type checker. It is also helpful to add
|
||||
links to online documentation or to the implementation of the code
|
||||
you are changing.
|
||||
|
||||
At present the core developers are (alphabetically):
|
||||
* David Fisher (@ddfisher)
|
||||
* Łukasz Langa (@ambv)
|
||||
@@ -103,8 +109,8 @@ 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**.
|
||||
|
||||
Make sure your changes pass tests by running ``runtests.sh`` (the
|
||||
[README](README.md) has more information).
|
||||
Make sure your changes pass the tests (the [README](README.md#running-the-tests)
|
||||
has more information).
|
||||
|
||||
### Using stubgen
|
||||
|
||||
@@ -135,12 +141,8 @@ rule is that they should be as concise as possible. Specifically:
|
||||
names, or methods and fields within a single class;
|
||||
* use a single blank line between top-level class definitions, or none
|
||||
if the classes are very small;
|
||||
* add a top-level comment followed by an empty line that makes it clear
|
||||
the file contains a stub and not the actual code for the module,
|
||||
for example `# Stubs for pathlib (Python 3.4)`;
|
||||
* do not use docstrings;
|
||||
* prefer type comments over variable annotations unless your stubs are
|
||||
exclusively targeting Python 3.6.
|
||||
* for arguments with a type and a default, use spaces around the `=`.
|
||||
|
||||
Imports in stubs are considered private (not part of the exported API)
|
||||
unless:
|
||||
@@ -149,6 +151,14 @@ unless:
|
||||
* they use the form ``from library import *`` which means all names
|
||||
from that library are exported.
|
||||
|
||||
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
|
||||
`Optional[]` around the type. The mypy tests enforce this (through
|
||||
the use of --no-implicit-optional) and the error looks like
|
||||
`Incompatible types in assignment (expression has type None, variable
|
||||
has type "Blah") `.
|
||||
|
||||
Stub files support forward references natively. In other words, the
|
||||
order of class declarations and type aliases does not matter in
|
||||
a stub file. You can also use the name of the class within its own
|
||||
@@ -159,11 +169,6 @@ Type variables and aliases you introduce purely for legibility reasons
|
||||
should be prefixed with an underscore to make it obvious to the reader
|
||||
they are not part of the stubbed API.
|
||||
|
||||
Finally, remember to include a comment on the top of your file about the
|
||||
version of the Python language your stubs were tested against and
|
||||
version of the library they were built for. This makes it easier to
|
||||
maintain the stubs in the future.
|
||||
|
||||
NOTE: there are stubs in this repository that don't conform to the
|
||||
style described above. Fixing them is a great starting point for new
|
||||
contributors.
|
||||
@@ -172,9 +177,23 @@ contributors.
|
||||
|
||||
There are separate directories for `stdlib` and `third_party` stubs.
|
||||
Within those, there are separate directories for different versions of
|
||||
Python the stubs target. If the given library works on both Python 2
|
||||
and Python 3, prefer to put your stubs in an `2and3` directory, unless
|
||||
the types are so different that the stubs become unreadable that way.
|
||||
Python the stubs target.
|
||||
|
||||
The directory name indicates the major version of Python that a stub targets
|
||||
and optionally the lowest minor version, with the exception of the `2and3`
|
||||
directory which applies to both Python 2 and 3.
|
||||
|
||||
For example, stubs in the `3` directory will be applied to all versions of
|
||||
Python 3, though stubs in the `3.6` directory will only be applied to versions
|
||||
3.6 and above. However, stubs in the `2` directory will not be applied to
|
||||
Python 3.
|
||||
|
||||
It is preferred to use a single stub in the more generic directory that
|
||||
conditionally targets specific versions when needed, as opposed
|
||||
to maintaining multiple stub files within more specific directories. Similarly,
|
||||
if the given library works on both Python 2 and Python 3, prefer to put your
|
||||
stubs in the `2and3` directory, unless the types are so different that the stubs
|
||||
become unreadable that way.
|
||||
|
||||
You can use checks like `if sys.version_info >= (3, 4):` to denote new
|
||||
functionality introduced in a given Python version or solve type
|
||||
@@ -217,23 +236,25 @@ project's tracker to fix their documentation.
|
||||
|
||||
## Issue-tracker conventions
|
||||
|
||||
We aim to reply to all new issues promptly. We'll assign a milestone
|
||||
to help us track which issues we intend to get to when, and may apply
|
||||
labels to carry some other information. Here's what our milestones
|
||||
and labels mean.
|
||||
We aim to reply to all new issues promptly. We'll assign one or more
|
||||
labels to 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.)
|
||||
|
||||
### Labels
|
||||
|
||||
* **needs discussion**: This issue needs agreement on some kind of
|
||||
design before it makes sense to implement it, and it either doesn't
|
||||
yet have a design or doesn't yet have agreement on one.
|
||||
* **help wanted**: This issue could use a volunteer willing to implement
|
||||
it. Those issues can be great starting points for new contributors!
|
||||
* **enhancement**, **bug**, **refactoring**: These classify the
|
||||
user-facing impact of the change. Specifically "refactoring" means
|
||||
there should be no user-facing effect.
|
||||
* **duplicate**, **wontfix**: These identify issues that we've closed
|
||||
for the respective reasons.
|
||||
* **blocked**: This issue is waiting for the resolution of some issue
|
||||
external to typeshed.
|
||||
* **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.
|
||||
|
||||
### Core developer guidelines
|
||||
|
||||
@@ -242,3 +263,5 @@ Core developers should follow these rules when processing pull requests:
|
||||
* Always wait for tests to pass before merging PRs.
|
||||
* Use "[Squash and merge](https://github.com/blog/2141-squash-your-commits)" to merge PRs.
|
||||
* Delete branches for merged PRs (by core devs pushing to the main repo).
|
||||
* Make sure commit messages to master are meaningful. For example, remove irrelevant
|
||||
intermediate commit messages.
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# typeshed
|
||||
|
||||
[](https://travis-ci.org/python/typeshed)
|
||||
[](https://gitter.im/python/typing?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
## About
|
||||
|
||||
Typeshed contains external type annotations for the Python standard library
|
||||
@@ -11,6 +14,34 @@ For information on how to use `typeshed`, read below. Information for
|
||||
contributors can be found in [CONTRIBUTING.md](CONTRIBUTING.md). **Please read
|
||||
it before submitting pull requests.**
|
||||
|
||||
Typeshed supports Python versions 2.7 and 3.3 and up.
|
||||
|
||||
## Using
|
||||
|
||||
If you're just using mypy (or pytype or PyCharm), as opposed to
|
||||
developing it, you don't need to interact with the typeshed repo at
|
||||
all: a copy of typeshed is bundled with mypy.
|
||||
|
||||
When you use a checked-out clone of the mypy repo, a copy of typeshed
|
||||
should be included as a submodule, using
|
||||
|
||||
$ git clone --recurse-submodules https://github.com/python/mypy.git
|
||||
|
||||
or
|
||||
|
||||
$ git clone https://github.com/python/mypy.git
|
||||
$ cd mypy
|
||||
$ git submodule init
|
||||
$ git submodule update
|
||||
|
||||
and occasionally you will have to repeat the final command (`git
|
||||
submodule update`) to pull in changes made in the upstream typeshed
|
||||
repo.
|
||||
|
||||
PyCharm and pytype similarly include a copy of typeshed. The one in
|
||||
pytype can be updated in the same way if you are working with the
|
||||
pytype repo.
|
||||
|
||||
## Format
|
||||
|
||||
Each Python module is represented by a `.pyi` "stub". This is a normal Python
|
||||
@@ -26,13 +57,15 @@ of the stub files.
|
||||
The below is an excerpt from the types for the `datetime` module.
|
||||
|
||||
```python
|
||||
from typing import Union
|
||||
|
||||
MAXYEAR = ... # type: int
|
||||
MINYEAR = ... # type: int
|
||||
|
||||
class date(object):
|
||||
def __init__(self, year: int, month: int, day: int) -> None: ...
|
||||
@classmethod
|
||||
def fromtimestamp(cls, timestamp: int or float) -> date: ...
|
||||
def fromtimestamp(cls, timestamp: Union[int, float]) -> date: ...
|
||||
@classmethod
|
||||
def fromordinal(cls, ordinal: int) -> date: ...
|
||||
@classmethod
|
||||
@@ -41,6 +74,24 @@ class date(object):
|
||||
def weekday(self) -> int: ...
|
||||
```
|
||||
|
||||
## Conventions
|
||||
|
||||
* At the time of this writing, `unicode` arguments, in Python 2 stubs, are
|
||||
interpreted by type-checkers as `Union[bytes, unicode]` (so it means the same
|
||||
as `Text`).
|
||||
Even so, in Python 2, whenever possible, use `unicode` if that's the only
|
||||
possible type, and `Text` if it can be either `unicode` or `bytes`.
|
||||
* Most type-checkers interpret optional parameters of the form `x : Foo = None`
|
||||
as `x : Optional[Foo] = ...`. (So the former is a shortcut for the latter)
|
||||
In typeshed, however, we prefer the explicit latter form.
|
||||
* When something is declared as taking only float, it also takes `int`. See
|
||||
https://www.python.org/dev/peps/pep-0484/#the-numeric-tower. So write `float`
|
||||
instead of `Union[int, float]`.
|
||||
* Avoid Union return types: https://github.com/python/mypy/issues/1693
|
||||
* Avoid invariant collection types (List, Dict) in argument positions, in favor
|
||||
of covariant types like Mapping or Sequence.
|
||||
|
||||
|
||||
## Directory structure
|
||||
|
||||
### stdlib
|
||||
@@ -71,16 +122,15 @@ https://github.com/python/typeshed/blob/master/CONTRIBUTING.md#stub-versioning).
|
||||
## Contributing
|
||||
|
||||
Please read [CONTRIBUTING.md](CONTRIBUTING.md) before submitting pull
|
||||
requests.
|
||||
requests. If you have questions related to contributing, drop by the [typing Gitter](https://gitter.im/python/typing).
|
||||
|
||||
## Running the tests
|
||||
|
||||
The tests are automatically run by Travis CI on every PR and push to
|
||||
the repo. There are two separate sets of tests: `tests/mypy_test.py`
|
||||
the repo. There are several sets of tests: `tests/mypy_test.py`
|
||||
runs tests against [mypy](https://github.com/python/mypy/), while
|
||||
`tests/pytype_tests.py` runs tests against
|
||||
[pytype](https://github.com/google/pytype/). The script runtests.sh
|
||||
runs both sets of tests and flake8 over all .pyi files.
|
||||
`tests/pytype_test.py` runs tests against
|
||||
[pytype](https://github.com/google/pytype/).
|
||||
|
||||
Both sets of tests are shallow -- they verify that all stubs can be
|
||||
imported but they don't check whether stubs match their implementation
|
||||
@@ -88,21 +138,33 @@ imported but they don't check whether stubs match their implementation
|
||||
that each set of tests has a blacklist of modules that are not tested
|
||||
at all. The blacklists also live in the tests directory.
|
||||
|
||||
To manually run the mypy tests, you need to have Python 3.5 or higher.
|
||||
In addition, you can run `tests/mypy_selftest.py` to run mypy's own
|
||||
test suite using the typeshed code in your repo. This will sometimes
|
||||
catch issues with incorrectly typed stubs, but is much slower than the
|
||||
other tests.
|
||||
|
||||
To manually run the mypy tests, you need to have Python 3.5 or higher;
|
||||
Python 3.6.1 or higher is recommended.
|
||||
|
||||
Run:
|
||||
```
|
||||
$ python3.5 -m venv .venv3
|
||||
$ python3.6 -m venv .venv3
|
||||
$ source .venv3/bin/activate
|
||||
(.venv3)$ pip install -r requirements-tests-py3.txt
|
||||
(.venv3)$ pip3 install -r requirements-tests-py3.txt
|
||||
```
|
||||
This will install mypy-lang, typed-ast, and flake8. You can then run
|
||||
mypy tests and flake8 tests by invoking:
|
||||
This will install mypy (you need the latest master branch from GitHub),
|
||||
typed-ast, and flake8. You can then run mypy tests and flake8 tests by
|
||||
invoking:
|
||||
```
|
||||
(.venv3)$ python tests/mypy_test.py
|
||||
(.venv3)$ python3 tests/mypy_test.py
|
||||
...
|
||||
(.venv3)$ python3 tests/mypy_selftest.py
|
||||
...
|
||||
(.venv3)$ flake8
|
||||
...
|
||||
```
|
||||
(Note that flake8 only works with Python 3.6 or higher.)
|
||||
|
||||
To run the pytype tests, you need a separate virtual environment with
|
||||
Python 2.7. Run:
|
||||
```
|
||||
@@ -116,25 +178,6 @@ tests by running:
|
||||
(.venv2)$ python tests/pytype_test.py
|
||||
```
|
||||
|
||||
To be able to everything with ``runtests.sh``, copy the ``pytype`` script
|
||||
from the Python 2 virtualenv to the Python 3 one:
|
||||
```
|
||||
$ cp .venv2/bin/pytype .venv3/bin/pytype
|
||||
$ source .venv3/bin/activate
|
||||
(.venv3)$ ./runtests.sh
|
||||
running mypy --python-version 3.6 --strict-optional # with 479 files
|
||||
running mypy --python-version 3.5 --strict-optional # with 469 files
|
||||
running mypy --python-version 3.4 --strict-optional # with 469 files
|
||||
running mypy --python-version 3.3 --strict-optional # with 454 files
|
||||
running mypy --python-version 3.2 --strict-optional # with 453 files
|
||||
running mypy --python-version 2.7 --strict-optional # with 502 files
|
||||
Running pytype tests...
|
||||
Ran pytype with 244 pyis, got 0 errors.
|
||||
Running flake8...
|
||||
flake8 run clean.
|
||||
(.venv3)$
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
mypy>=0.501
|
||||
typed-ast>=1.0.2
|
||||
git+https://github.com/python/mypy.git@master
|
||||
typed-ast>=1.0.4
|
||||
flake8==3.3.0
|
||||
flake8-bugbear>=17.3.0
|
||||
flake8-pyi>=17.1.0
|
||||
|
||||
@@ -78,10 +78,10 @@ class RawConfigParser:
|
||||
def optionxform(self, optionstr: str) -> str: ...
|
||||
def has_option(self, section: str, option: str) -> bool: ...
|
||||
def set(self, section: str, option: str, value: Any = ...) -> None: ...
|
||||
def write(self, fp: file) -> None: ...
|
||||
def write(self, fp: IO[str]) -> None: ...
|
||||
def remove_option(self, section: str, option: Any) -> bool: ...
|
||||
def remove_section(self, section: str) -> bool: ...
|
||||
def _read(self, fp: file, fpname: str) -> None: ...
|
||||
def _read(self, fp: IO[str], fpname: str) -> None: ...
|
||||
|
||||
class ConfigParser(RawConfigParser):
|
||||
_KEYCRE = ... # type: Any
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for Cookie (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class CookieError(Exception): ...
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Stubs for SimpleHTTPServer (Python 2)
|
||||
|
||||
from typing import Any, AnyStr, IO, Mapping, Optional, Union
|
||||
import BaseHTTPServer
|
||||
from StringIO import StringIO
|
||||
|
||||
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
server_version = ... # type: str
|
||||
def do_GET(self) -> None: ...
|
||||
def do_HEAD(self) -> None: ...
|
||||
def send_head(self) -> Optional[IO[str]]: ...
|
||||
def list_directory(self, path: Union[str, unicode]) -> Optional[StringIO]: ...
|
||||
def translate_path(self, path: AnyStr) -> AnyStr: ...
|
||||
def copyfile(self, source: IO[AnyStr], outputfile: IO[AnyStr]): ...
|
||||
def guess_type(self, path: Union[str, unicode]) -> str: ...
|
||||
extensions_map = ... # type: Mapping[str, str]
|
||||
@@ -92,11 +92,6 @@ class int(SupportsInt, SupportsFloat, SupportsAbs[int]):
|
||||
@overload
|
||||
def __init__(self, x: Union[str, unicode, bytearray], base: int = ...) -> None: ...
|
||||
|
||||
@overload
|
||||
def __new__(cls: Type[_T1], x: SupportsInt = ...) -> _T1: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T1], x: Union[str, unicode, bytearray], base: int = ...) -> _T1: ...
|
||||
|
||||
def bit_length(self) -> int: ...
|
||||
|
||||
def __add__(self, x: int) -> int: ...
|
||||
@@ -144,14 +139,7 @@ class int(SupportsInt, SupportsFloat, SupportsAbs[int]):
|
||||
def __nonzero__(self) -> bool: ...
|
||||
|
||||
class float(SupportsFloat, SupportsInt, SupportsAbs[float]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: SupportsFloat) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: unicode) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: bytearray) -> None: ...
|
||||
def __init__(self, x: Union[SupportsFloat, str, unicode, bytearray] = ...) -> None: ...
|
||||
def as_integer_ratio(self) -> Tuple[int, int]: ...
|
||||
def hex(self) -> str: ...
|
||||
def is_integer(self) -> bool: ...
|
||||
@@ -314,7 +302,6 @@ class unicode(basestring, Sequence[unicode]):
|
||||
|
||||
class str(basestring, Sequence[str]):
|
||||
def __init__(self, object: object = ...) -> None: ...
|
||||
def __new__(cls: Type[_T1], object: object = ...) -> _T1: ...
|
||||
def capitalize(self) -> str: ...
|
||||
def center(self, width: int, fillchar: str = ...) -> str: ...
|
||||
def count(self, x: unicode, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
@@ -492,7 +479,7 @@ class slice(object):
|
||||
@overload
|
||||
def __init__(self, stop: Optional[int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, start: Optional[int], stop: Optional[int], step: int = None) -> None: ...
|
||||
def __init__(self, start: Optional[int], stop: Optional[int], step: Optional[int] = None) -> None: ...
|
||||
def indices(self, len: int) -> Tuple[int, int, int]: ...
|
||||
|
||||
class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
@@ -613,9 +600,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[Any]) -> bool: ...
|
||||
def issubset(self, s: Iterable[Any]) -> bool: ...
|
||||
def issuperset(self, s: Iterable[Any]) -> bool: ...
|
||||
def isdisjoint(self, s: Iterable[object]) -> bool: ...
|
||||
def issubset(self, s: Iterable[object]) -> bool: ...
|
||||
def issuperset(self, s: Iterable[object]) -> bool: ...
|
||||
def pop(self) -> _T: ...
|
||||
def remove(self, element: _T) -> None: ...
|
||||
def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ...
|
||||
@@ -626,18 +613,18 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __and__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __iand__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __and__(self, s: AbstractSet[object]) -> Set[_T]: ...
|
||||
def __iand__(self, s: AbstractSet[object]) -> Set[_T]: ...
|
||||
def __or__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __ior__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __sub__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __isub__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __sub__(self, s: AbstractSet[object]) -> Set[_T]: ...
|
||||
def __isub__(self, s: AbstractSet[object]) -> Set[_T]: ...
|
||||
def __xor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __ixor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __le__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __le__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __lt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __gt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
# TODO more set operations
|
||||
|
||||
class frozenset(AbstractSet[_T], Generic[_T]):
|
||||
@@ -646,11 +633,11 @@ class frozenset(AbstractSet[_T], Generic[_T]):
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
def copy(self) -> FrozenSet[_T]: ...
|
||||
def difference(self, *s: Iterable[Any]) -> FrozenSet[_T]: ...
|
||||
def intersection(self, *s: Iterable[Any]) -> FrozenSet[_T]: ...
|
||||
def difference(self, *s: Iterable[object]) -> FrozenSet[_T]: ...
|
||||
def intersection(self, *s: Iterable[object]) -> FrozenSet[_T]: ...
|
||||
def isdisjoint(self, s: Iterable[_T]) -> bool: ...
|
||||
def issubset(self, s: Iterable[Any]) -> bool: ...
|
||||
def issuperset(self, s: Iterable[Any]) -> bool: ...
|
||||
def issubset(self, s: Iterable[object]) -> bool: ...
|
||||
def issuperset(self, s: Iterable[object]) -> bool: ...
|
||||
def symmetric_difference(self, s: Iterable[_T]) -> FrozenSet[_T]: ...
|
||||
def union(self, *s: Iterable[_T]) -> FrozenSet[_T]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@@ -661,10 +648,10 @@ class frozenset(AbstractSet[_T], Generic[_T]):
|
||||
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T, _S]]: ...
|
||||
def __sub__(self, s: AbstractSet[_T]) -> FrozenSet[_T]: ...
|
||||
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T, _S]]: ...
|
||||
def __le__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __le__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __lt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __gt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
|
||||
class enumerate(Iterator[Tuple[int, _T]], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T], start: int = 0) -> None: ...
|
||||
@@ -682,19 +669,14 @@ class xrange(Sized, Iterable[int], Reversible[int]):
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
def __reversed__(self) -> Iterator[int]: ...
|
||||
|
||||
class module:
|
||||
__name__ = ... # type: str
|
||||
__file__ = ... # type: str
|
||||
__dict__ = ... # type: Dict[unicode, Any]
|
||||
|
||||
class property(object):
|
||||
def __init__(self, fget: Callable[[Any], Any] = None,
|
||||
fset: Callable[[Any, Any], None] = None,
|
||||
fdel: Callable[[Any], None] = None, doc: str = None) -> None: ...
|
||||
def __init__(self, fget: Optional[Callable[[Any], Any]] = None,
|
||||
fset: Optional[Callable[[Any, Any], None]] = None,
|
||||
fdel: Optional[Callable[[Any], None]] = None, doc: Optional[str] = None) -> 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: ...
|
||||
def __get__(self, obj: Any, type: type=None) -> Any: ...
|
||||
def __get__(self, obj: Any, type: Optional[type] = None) -> Any: ...
|
||||
def __set__(self, obj: Any, value: Any) -> None: ...
|
||||
def __delete__(self, obj: Any) -> None: ...
|
||||
def fget(self) -> Any: ...
|
||||
@@ -707,8 +689,8 @@ bytes = str
|
||||
NotImplemented = ... # type: Any
|
||||
|
||||
def abs(n: SupportsAbs[_T]) -> _T: ...
|
||||
def all(i: Iterable) -> bool: ...
|
||||
def any(i: Iterable) -> bool: ...
|
||||
def all(i: Iterable[object]) -> bool: ...
|
||||
def any(i: Iterable[object]) -> bool: ...
|
||||
def bin(number: int) -> str: ...
|
||||
def callable(o: object) -> bool: ...
|
||||
def chr(code: int) -> str: ...
|
||||
@@ -728,7 +710,7 @@ def filter(function: Callable[[_T], Any],
|
||||
def filter(function: None,
|
||||
iterable: Iterable[Optional[_T]]) -> List[_T]: ...
|
||||
def format(o: object, format_spec: str = '') -> str: ... # TODO unicode
|
||||
def getattr(o: Any, name: unicode, default: Any = None) -> Any: ...
|
||||
def getattr(o: Any, name: unicode, default: Optional[Any] = None) -> Any: ...
|
||||
def hasattr(o: Any, name: unicode) -> bool: ...
|
||||
def hash(o: object) -> int: ...
|
||||
def hex(i: int) -> str: ... # TODO __index__
|
||||
@@ -762,14 +744,14 @@ def next(i: Iterator[_T]) -> _T: ...
|
||||
def next(i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
|
||||
def oct(i: int) -> str: ... # TODO __index__
|
||||
@overload
|
||||
def open(file: str, mode: str = 'r', buffering: int = ...) -> BinaryIO: ...
|
||||
def open(file: str, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
|
||||
@overload
|
||||
def open(file: unicode, mode: str = 'r', buffering: int = ...) -> BinaryIO: ...
|
||||
def open(file: unicode, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
|
||||
@overload
|
||||
def open(file: int, mode: str = 'r', buffering: int = ...) -> BinaryIO: ...
|
||||
def open(file: int, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
|
||||
def ord(c: unicode) -> int: ...
|
||||
# This is only available after from __future__ import print_function.
|
||||
def print(*values: Any, sep: unicode = u' ', end: unicode = u'\n',
|
||||
def print(*values: Any, sep: unicode = ..., end: unicode = ...,
|
||||
file: IO[Any] = ...) -> None: ...
|
||||
@overload
|
||||
def pow(x: int, y: int) -> Any: ... # The return type can be int or float, depending on y.
|
||||
@@ -780,7 +762,7 @@ def pow(x: float, y: float) -> float: ...
|
||||
@overload
|
||||
def pow(x: float, y: float, z: float) -> float: ...
|
||||
def quit(code: int = ...) -> None: ...
|
||||
def range(x: int, y: int = 0, step: int = 1) -> List[int]: ...
|
||||
def range(x: int, y: int = ..., step: int = ...) -> List[int]: ...
|
||||
def raw_input(prompt: Any = ...) -> str: ...
|
||||
|
||||
@overload
|
||||
@@ -927,6 +909,7 @@ class SyntaxError(StandardError):
|
||||
lineno = ... # type: int
|
||||
offset = ... # type: int
|
||||
text = ... # type: str
|
||||
filename = ... # type: str
|
||||
class IndentationError(SyntaxError): ...
|
||||
class TabError(IndentationError): ...
|
||||
class SystemError(StandardError): ...
|
||||
@@ -950,14 +933,14 @@ class UnicodeWarning(Warning): ...
|
||||
class BytesWarning(Warning): ...
|
||||
class ResourceWarning(Warning): ...
|
||||
|
||||
def eval(s: str, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> Any: ...
|
||||
def eval(s: Union[str, unicode], globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> Any: ...
|
||||
def exec(object: str,
|
||||
globals: Dict[str, Any] = None,
|
||||
locals: Dict[str, Any] = None) -> Any: ... # TODO code object as source
|
||||
globals: Optional[Dict[str, Any]] = None,
|
||||
locals: Optional[Dict[str, Any]] = None) -> Any: ... # TODO code object as source
|
||||
|
||||
def cmp(x: Any, y: Any) -> int: ...
|
||||
|
||||
def execfile(filename: str, globals: Dict[str, Any] = None, locals: Dict[str, Any] = None) -> None: ...
|
||||
def execfile(filename: str, globals: Optional[Dict[str, Any]] = None, locals: Optional[Dict[str, Any]] = None) -> None: ...
|
||||
|
||||
class file(BinaryIO):
|
||||
@overload
|
||||
@@ -969,7 +952,7 @@ class file(BinaryIO):
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def read(self, n: int = ...) -> str: ...
|
||||
def __enter__(self) -> BinaryIO: ...
|
||||
def __exit__(self, t: type = None, exc: BaseException = None, tb: Any = None) -> bool: ...
|
||||
def __exit__(self, t: Optional[type] = None, exc: Optional[BaseException] = None, tb: Optional[Any] = None) -> bool: ...
|
||||
def flush(self) -> None: ...
|
||||
def fileno(self) -> int: ...
|
||||
def isatty(self) -> bool: ...
|
||||
@@ -987,6 +970,6 @@ class file(BinaryIO):
|
||||
def truncate(self, pos: Optional[int] = ...) -> int: ...
|
||||
|
||||
# Very old builtins
|
||||
def apply(func: Callable[..., _T], args: Sequence[Any] = None, kwds: Mapping[str, Any] = None) -> _T: ...
|
||||
def apply(func: Callable[..., _T], args: Optional[Sequence[Any]] = None, kwds: Optional[Mapping[str, Any]] = None) -> _T: ...
|
||||
_N = TypeVar('_N', bool, int, float, complex)
|
||||
def coerce(x: _N, y: _N) -> Tuple[_N, _N]: ...
|
||||
|
||||
@@ -5,7 +5,7 @@ __version__ = ... # type: str
|
||||
|
||||
PyCF_ONLY_AST = ... # type: int
|
||||
|
||||
identifier = str
|
||||
_identifier = str
|
||||
|
||||
class AST:
|
||||
_attributes = ... # type: typing.Tuple[str, ...]
|
||||
@@ -33,13 +33,13 @@ class stmt(AST):
|
||||
col_offset = ... # type: int
|
||||
|
||||
class FunctionDef(stmt):
|
||||
name = ... # type: identifier
|
||||
name = ... # type: _identifier
|
||||
args = ... # type: arguments
|
||||
body = ... # type: typing.List[stmt]
|
||||
decorator_list = ... # type: typing.List[expr]
|
||||
|
||||
class ClassDef(stmt):
|
||||
name = ... # type: identifier
|
||||
name = ... # type: _identifier
|
||||
bases = ... # type: typing.List[expr]
|
||||
body = ... # type: typing.List[stmt]
|
||||
decorator_list = ... # type: typing.List[expr]
|
||||
@@ -107,7 +107,7 @@ class Import(stmt):
|
||||
names = ... # type: typing.List[alias]
|
||||
|
||||
class ImportFrom(stmt):
|
||||
module = ... # type: Optional[identifier]
|
||||
module = ... # type: Optional[_identifier]
|
||||
names = ... # type: typing.List[alias]
|
||||
level = ... # type: Optional[int]
|
||||
|
||||
@@ -117,7 +117,7 @@ class Exec(stmt):
|
||||
locals = ... # type: Optional[expr]
|
||||
|
||||
class Global(stmt):
|
||||
names = ... # type: typing.List[identifier]
|
||||
names = ... # type: typing.List[_identifier]
|
||||
|
||||
class Expr(stmt):
|
||||
value = ... # type: expr
|
||||
@@ -222,7 +222,7 @@ class Str(expr):
|
||||
|
||||
class Attribute(expr):
|
||||
value = ... # type: expr
|
||||
attr = ... # type: identifier
|
||||
attr = ... # type: _identifier
|
||||
ctx = ... # type: expr_context
|
||||
|
||||
class Subscript(expr):
|
||||
@@ -231,7 +231,7 @@ class Subscript(expr):
|
||||
ctx = ... # type: expr_context
|
||||
|
||||
class Name(expr):
|
||||
id = ... # type: identifier
|
||||
id = ... # type: _identifier
|
||||
ctx = ... # type: expr_context
|
||||
|
||||
class List(expr):
|
||||
@@ -315,14 +315,14 @@ class ExceptHandler(AST):
|
||||
|
||||
class arguments(AST):
|
||||
args = ... # type: typing.List[expr]
|
||||
vararg = ... # type: Optional[identifier]
|
||||
kwarg = ... # type: Optional[identifier]
|
||||
vararg = ... # type: Optional[_identifier]
|
||||
kwarg = ... # type: Optional[_identifier]
|
||||
defaults = ... # type: typing.List[expr]
|
||||
|
||||
class keyword(AST):
|
||||
arg = ... # type: identifier
|
||||
arg = ... # type: _identifier
|
||||
value = ... # type: expr
|
||||
|
||||
class alias(AST):
|
||||
name = ... # type: identifier
|
||||
asname = ... # type: Optional[identifier]
|
||||
name = ... # type: _identifier
|
||||
asname = ... # type: Optional[_identifier]
|
||||
|
||||
@@ -1,107 +1,168 @@
|
||||
from typing import Any, Optional, Iterable, Tuple, List, Union
|
||||
from typing import Any, AnyStr, BinaryIO, IO, Text, TextIO, Iterable, Iterator, List, Optional, Type, Tuple, TypeVar, Union
|
||||
from types import TracebackType
|
||||
|
||||
DEFAULT_BUFFER_SIZE = ... # type: int
|
||||
|
||||
|
||||
class BlockingIOError(IOError):
|
||||
characters_written = ... # type: int
|
||||
|
||||
class UnsupportedOperation(ValueError, IOError): ...
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class _IOBase(object):
|
||||
closed = ... # type: bool
|
||||
def __enter__(self) -> "_IOBase": ...
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
def __iter__(self) -> "_IOBase": ...
|
||||
class _IOBase(BinaryIO):
|
||||
@property
|
||||
def closed(self) -> bool: ...
|
||||
def _checkClosed(self) -> None: ...
|
||||
def _checkReadable(self) -> None: ...
|
||||
def _checkSeekable(self) -> None: ...
|
||||
def _checkWritable(self) -> None: ...
|
||||
# All these methods are concrete here (you can instantiate this)
|
||||
def close(self) -> None: ...
|
||||
def fileno(self) -> int: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def next(self) -> str: ...
|
||||
def readable(self) -> bool: ...
|
||||
def readline(self, limit: int = ...) -> str: ...
|
||||
def readlines(self, hint: int = ...) -> List[str]: ...
|
||||
def seek(self, offset: int, whence: int = ...) -> None: ...
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def tell(self) -> int: ...
|
||||
def truncate(self, size: int = ...) -> int: ...
|
||||
def truncate(self, size: Optional[int] = ...) -> int: ...
|
||||
def writable(self) -> bool: ...
|
||||
def writelines(self, lines: Iterable[str]) -> None: ...
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> bool: ...
|
||||
def __iter__(self: _T) -> _T: ...
|
||||
# The parameter type of writelines[s]() is determined by that of write():
|
||||
def writelines(self, lines: Iterable[bytes]) -> None: ...
|
||||
# The return type of readline[s]() and next() is determined by that of read():
|
||||
def readline(self, limit: int = ...) -> bytes: ...
|
||||
def readlines(self, hint: int = ...) -> list[bytes]: ...
|
||||
def next(self) -> bytes: ...
|
||||
|
||||
class _BufferedIOBase(_IOBase):
|
||||
def read1(self, n: int) -> str: ...
|
||||
def read(self, n: int = ...) -> str: ...
|
||||
def read1(self, n: int) -> bytes: ...
|
||||
def read(self, size: int = ...) -> bytes: ...
|
||||
def readinto(self, buffer: bytearray) -> int: ...
|
||||
def write(self, s: str) -> int: ...
|
||||
def detach(self) -> "_BufferedIOBase": ...
|
||||
def write(self, s: bytes) -> int: ...
|
||||
def detach(self) -> _IOBase: ...
|
||||
|
||||
class BufferedRWPair(_BufferedIOBase):
|
||||
def peek(self, n: int = ...) -> str: ...
|
||||
def __init__(self, reader: _RawIOBase, writer: _RawIOBase,
|
||||
buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
|
||||
def peek(self, n: int = ...) -> bytes: ...
|
||||
def __enter__(self) -> BufferedRWPair: ...
|
||||
|
||||
class BufferedRandom(_BufferedIOBase):
|
||||
mode = ... # type: str
|
||||
name = ... # type: str
|
||||
raw = ... # type: _IOBase
|
||||
mode = ... # type: str
|
||||
def peek(self, n: int = ...) -> str: ...
|
||||
def __init__(self, raw: _IOBase,
|
||||
buffer_size: int = ...,
|
||||
max_buffer_size: int = ...) -> None: ...
|
||||
def peek(self, n: int = ...) -> bytes: ...
|
||||
|
||||
class BufferedReader(_BufferedIOBase):
|
||||
mode = ... # type: str
|
||||
name = ... # type: str
|
||||
raw = ... # type: _IOBase
|
||||
mode = ... # type: str
|
||||
def peek(self, n: int = ...) -> str: ...
|
||||
def __init__(self, raw: _IOBase, buffer_size: int = ...) -> None: ...
|
||||
def peek(self, n: int = ...) -> bytes: ...
|
||||
|
||||
class BufferedWriter(_BufferedIOBase):
|
||||
name = ... # type: str
|
||||
raw = ... # type: _IOBase
|
||||
mode = ... # type: str
|
||||
def __init__(self, raw: _IOBase,
|
||||
buffer_size: int = ...,
|
||||
max_buffer_size: int = ...) -> None: ...
|
||||
|
||||
class BytesIO(_BufferedIOBase):
|
||||
def __init__(self, initial_bytes: bytes = ...) -> None: ...
|
||||
def __setstate__(self, tuple) -> None: ...
|
||||
def __getstate__(self) -> tuple: ...
|
||||
def getvalue(self) -> str: ...
|
||||
def getvalue(self) -> bytes: ...
|
||||
def write(self, s: bytes) -> int: ...
|
||||
def writelines(self, lines: Iterable[bytes]) -> None: ...
|
||||
def read1(self, size: int) -> bytes: ...
|
||||
def next(self) -> bytes: ...
|
||||
|
||||
class _RawIOBase(_IOBase):
|
||||
def readall(self) -> str: ...
|
||||
def read(self, n: int = ...) -> str: ...
|
||||
|
||||
class FileIO(_RawIOBase):
|
||||
class FileIO(_RawIOBase, BytesIO): # type: ignore # for __enter__
|
||||
mode = ... # type: str
|
||||
closefd = ... # type: bool
|
||||
def __init__(self, file: str, mode: str = ..., closefd: bool = ...) -> None: ...
|
||||
def readinto(self, buffer: bytearray)-> int: ...
|
||||
def write(self, pbuf: str) -> int: ...
|
||||
|
||||
class IncrementalNewlineDecoder(object):
|
||||
newlines = ... # type: Union[str, unicode]
|
||||
def __init__(self, decoder, translate, z=...) -> None: ...
|
||||
def decode(self, input, final) -> Any: ...
|
||||
def getstate(self) -> Tuple[Any, int]: ...
|
||||
def setstate(self, state: Tuple[Any, int]) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
|
||||
class _TextIOBase(_IOBase):
|
||||
|
||||
# Note: In the actual _io.py, _TextIOBase inherits from _IOBase.
|
||||
class _TextIOBase(TextIO):
|
||||
errors = ... # type: Optional[str]
|
||||
newlines = ... # type: Union[str, unicode]
|
||||
encoding = ... # type: Optional[str]
|
||||
def read(self, n: int = ...) -> str: ...
|
||||
def write(self) -> None:
|
||||
raise UnsupportedOperation
|
||||
def detach(self) -> None:
|
||||
raise UnsupportedOperation
|
||||
# TODO: On _TextIOBase, this is always None. But it's unicode/bytes in subclasses.
|
||||
newlines = ... # type: Union[None, unicode, bytes]
|
||||
encoding = ... # type: str
|
||||
@property
|
||||
def closed(self) -> bool: ...
|
||||
def _checkClosed(self) -> None: ...
|
||||
def _checkReadable(self) -> None: ...
|
||||
def _checkSeekable(self) -> None: ...
|
||||
def _checkWritable(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def detach(self) -> IO: ...
|
||||
def fileno(self) -> int: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def next(self) -> unicode: ...
|
||||
def read(self, size: int = ...) -> unicode: ...
|
||||
def readable(self) -> bool: ...
|
||||
def readline(self, limit: int = ...) -> unicode: ...
|
||||
def readlines(self, hint: int = ...) -> list[unicode]: ...
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def tell(self) -> int: ...
|
||||
def truncate(self, size: Optional[int] = ...) -> int: ...
|
||||
def writable(self) -> bool: ...
|
||||
def write(self, pbuf: unicode) -> int: ...
|
||||
def writelines(self, lines: Iterable[unicode]) -> None: ...
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> bool: ...
|
||||
def __iter__(self: _T) -> _T: ...
|
||||
|
||||
class StringIO(_TextIOBase):
|
||||
line_buffering = ... # type: bool
|
||||
def getvalue(self) -> str: ...
|
||||
def __init__(self,
|
||||
initial_value: Optional[unicode] = ...,
|
||||
newline: Optional[unicode] = ...) -> None: ...
|
||||
def __setstate__(self, state: tuple) -> None: ...
|
||||
def __getstate__(self) -> tuple: ...
|
||||
def getvalue(self) -> unicode: ...
|
||||
|
||||
class TextIOWrapper(_TextIOBase):
|
||||
name = ... # type: str
|
||||
line_buffering = ... # type: bool
|
||||
buffer = ... # type: str
|
||||
buffer = ... # type: BinaryIO
|
||||
_CHUNK_SIZE = ... # type: int
|
||||
def __init__(self, buffer: IO,
|
||||
encoding: Optional[Text] = ...,
|
||||
errors: Optional[Text] = ...,
|
||||
newline: Optional[Text] = ...,
|
||||
line_buffering: bool = ...,
|
||||
write_through: bool = ...) -> None: ...
|
||||
|
||||
def open(file: Union[int, str], mode: str = ...) -> _IOBase: ...
|
||||
def open(file: Union[str, unicode, int],
|
||||
mode: unicode = ...,
|
||||
buffering: int = ...,
|
||||
encoding: Optional[Text] = ...,
|
||||
errors: Optional[Text] = ...,
|
||||
newline: Optional[Text] = ...,
|
||||
closefd: bool = ...) -> IO[Any]: ...
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Source: https://hg.python.org/cpython/file/2.7/Lib/_threading_local.py
|
||||
from typing import Any, List
|
||||
|
||||
__all__: List[str]
|
||||
|
||||
class _localbase(object): ...
|
||||
|
||||
class local(_localbase):
|
||||
def __getattribute__(self, name: str) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||
def __delattr__(self, name: str) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
def _patch(self: local) -> None: ...
|
||||
@@ -1,11 +1,11 @@
|
||||
from typing import Any, List
|
||||
from typing import Any, List, Optional, Type
|
||||
|
||||
default_action = ... # type: str
|
||||
filters = ... # type: List[tuple]
|
||||
once_registry = ... # type: dict
|
||||
|
||||
def warn(message: Warning, category: type = ..., stacklevel: int = ...) -> None: ...
|
||||
def warn_explicit(message: Warning, category: type,
|
||||
def warn(message: Warning, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ...
|
||||
def warn_explicit(message: Warning, category: Optional[Type[Warning]],
|
||||
filename: str, lineno: int,
|
||||
module: Any = ..., registry: dict = ...,
|
||||
module_globals: dict = ...) -> None: ...
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
from typing import Any, Dict, Set, Tuple, Type
|
||||
import _weakrefset
|
||||
|
||||
# mypy has special processing for ABCMeta and abstractmethod.
|
||||
|
||||
WeakSet = ... # type: _weakrefset.WeakSet
|
||||
_InstanceType = ... # type: type
|
||||
types = ... # type: module
|
||||
# NOTE: mypy has special processing for ABCMeta and abstractmethod.
|
||||
|
||||
def abstractmethod(funcobj: Any) -> Any: ...
|
||||
|
||||
@@ -23,9 +19,6 @@ class ABCMeta(type):
|
||||
def _dump_registry(cls: "ABCMeta", *args: Any, **kwargs: Any) -> None: ...
|
||||
def register(cls: "ABCMeta", subclass: Type[Any]) -> None: ...
|
||||
|
||||
class _C:
|
||||
pass
|
||||
|
||||
# TODO: The real abc.abstractproperty inherits from "property".
|
||||
class abstractproperty(object):
|
||||
def __new__(cls, func: Any) -> Any: ...
|
||||
|
||||
@@ -3,25 +3,14 @@
|
||||
import typing
|
||||
from typing import Any, Iterator, Union
|
||||
|
||||
from _ast import (
|
||||
Add, alias, And, arguments, Assert, Assign, AST, Attribute, AugAssign,
|
||||
AugLoad, AugStore, BinOp, BitAnd, BitOr, BitXor, BoolOp, boolop, Break,
|
||||
Call, ClassDef, cmpop, Compare, comprehension, Continue, Del, Delete, Dict,
|
||||
DictComp, Div, Ellipsis, Eq, ExceptHandler, Exec, Expr, expr, Expression,
|
||||
expr_context, ExtSlice, FloorDiv, For, FunctionDef, GeneratorExp, Global,
|
||||
Gt, GtE, If, IfExp, Import, ImportFrom, In, Index, Interactive, Invert, Is,
|
||||
IsNot, keyword, Lambda, List, ListComp, Load, LShift, Lt, LtE, Mod, mod,
|
||||
Module, Mult, Name, Not, NotEq, NotIn, Num, operator, Or, Param, Pass, Pow,
|
||||
Print, Raise, Repr, Return, RShift, Set, SetComp, Slice, slice, stmt,
|
||||
Store, Str, Sub, Subscript, Suite, TryExcept, TryFinally, Tuple, UAdd,
|
||||
UnaryOp, unaryop, USub, While, With, Yield
|
||||
)
|
||||
from _ast import *
|
||||
from _ast import AST, Module
|
||||
|
||||
__version__ = ... # type: str
|
||||
PyCF_ONLY_AST = ... # type: int
|
||||
|
||||
|
||||
def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...) -> Module: ...
|
||||
def parse(source: Union[str, unicode], filename: Union[str, unicode] = ..., mode: Union[str, unicode] = ...) -> Module: ...
|
||||
def copy_location(new_node: AST, old_node: AST) -> AST: ...
|
||||
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
|
||||
def fix_missing_locations(node: AST) -> AST: ...
|
||||
@@ -29,7 +18,7 @@ def get_docstring(node: AST, clean: bool = ...) -> str: ...
|
||||
def increment_lineno(node: AST, n: int = ...) -> AST: ...
|
||||
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
|
||||
def iter_fields(node: AST) -> Iterator[typing.Tuple[str, Any]]: ...
|
||||
def literal_eval(node_or_string: Union[str, AST]) -> Any: ...
|
||||
def literal_eval(node_or_string: Union[str, unicode, AST]) -> Any: ...
|
||||
def walk(node: AST) -> Iterator[AST]: ...
|
||||
|
||||
class NodeVisitor():
|
||||
|
||||
@@ -2,23 +2,36 @@
|
||||
|
||||
# Based on http://docs.python.org/2.7/library/collections.html
|
||||
|
||||
# TODO more abstract base classes (interfaces in mypy)
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import (
|
||||
Any, Container, Dict, Generic, TypeVar, Iterable, Tuple, Callable, Mapping, overload,
|
||||
Iterator, Type, Sized, Optional, List, Set, Sequence, Union, Reversible,
|
||||
MutableMapping, MutableSet, MutableSequence,
|
||||
)
|
||||
# These are not exported.
|
||||
import typing
|
||||
from typing import Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible
|
||||
|
||||
# These are exported.
|
||||
from typing import (
|
||||
Callable as Callable,
|
||||
Container as Container,
|
||||
Hashable as Hashable,
|
||||
ItemsView as ItemsView,
|
||||
Iterable as Iterable,
|
||||
Iterator as Iterator,
|
||||
KeysView as KeysView,
|
||||
Mapping as Mapping,
|
||||
MappingView as MappingView,
|
||||
MutableMapping as MutableMapping,
|
||||
MutableSequence as MutableSequence,
|
||||
MutableSet as MutableSet,
|
||||
Sequence as Sequence,
|
||||
AbstractSet as Set,
|
||||
Sized as Sized,
|
||||
ValuesView as ValuesView,
|
||||
)
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_KT = TypeVar('_KT')
|
||||
_VT = TypeVar('_VT')
|
||||
|
||||
# namedtuple is special-cased in the type checker; the initializer is ignored.
|
||||
def namedtuple(typename: Union[str, unicode], field_names: Union[str, unicode, Iterable[Any]], *,
|
||||
def namedtuple(typename: Union[str, unicode], field_names: Union[str, unicode, Iterable[Union[str, unicode]]], *,
|
||||
verbose: bool = ..., rename: bool = ...) -> Type[tuple]: ...
|
||||
|
||||
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
|
||||
@@ -47,17 +60,16 @@ class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
|
||||
def __reversed__(self) -> Iterator[_T]: ...
|
||||
|
||||
class Counter(Dict[_T, int], Generic[_T]):
|
||||
# TODO: __init__ keyword arguments
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
def __init__(self, **kwargs: int) -> None: ...
|
||||
@overload
|
||||
def __init__(self, Mapping: Mapping[_T, int]) -> None: ...
|
||||
def __init__(self, mapping: Mapping[_T, int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
def elements(self) -> Iterator[_T]: ...
|
||||
def most_common(self, n: int = ...) -> List[_T]: ...
|
||||
def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ...
|
||||
@overload
|
||||
def subtract(self, mapping: Mapping[_T, int]) -> None: ...
|
||||
def subtract(self, __mapping: Mapping[_T, int]) -> None: ...
|
||||
@overload
|
||||
def subtract(self, iterable: Iterable[_T]) -> None: ...
|
||||
# The Iterable[Tuple[...]] argument type is not actually desirable
|
||||
@@ -72,26 +84,29 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
@overload
|
||||
def update(self, **kwargs: int) -> None: ...
|
||||
|
||||
def __add__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __sub__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __and__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __or__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __iadd__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __isub__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __iand__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __ior__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
|
||||
class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
|
||||
def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ...
|
||||
def move_to_end(self, key: _KT, last: bool = ...) -> None: ...
|
||||
def __reversed__(self) -> Iterator[_KT]: ...
|
||||
|
||||
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
default_factory = ... # type: Callable[[], _VT]
|
||||
# TODO: __init__ keyword args
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
def __init__(self, **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def __init__(self, map: Mapping[_KT, _VT]) -> None: ...
|
||||
def __init__(self, default_factory: Optional[Callable[[], _VT]]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Callable[[], _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Callable[[], _VT],
|
||||
def __init__(self, default_factory: Optional[Callable[[], _VT]],
|
||||
map: Mapping[_KT, _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Callable[[], _VT],
|
||||
def __init__(self, default_factory: Optional[Callable[[], _VT]],
|
||||
iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
|
||||
def __missing__(self, key: _KT) -> _VT: ...
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Optional, Pattern, Union
|
||||
|
||||
_Path = Union[str, bytes]
|
||||
|
||||
# fx can be any object with a 'search' method; once we have Protocols we can change the type
|
||||
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> None: ...
|
||||
def compile_file(fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> None: ...
|
||||
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> None: ...
|
||||
# rx can be any object with a 'search' method; once we have Protocols we can change the type
|
||||
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> int: ...
|
||||
def compile_file(fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> int: ...
|
||||
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ...
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for cookielib (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class Cookie:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from time import struct_time
|
||||
from typing import Optional, SupportsAbs, Tuple, Union, overload
|
||||
from typing import AnyStr, Optional, SupportsAbs, Tuple, Union, overload
|
||||
|
||||
MINYEAR = 0
|
||||
MAXYEAR = 0
|
||||
@@ -39,7 +39,7 @@ class date(object):
|
||||
|
||||
def ctime(self) -> str: ...
|
||||
def strftime(self, fmt: Union[str, unicode]) -> str: ...
|
||||
def __format__(self, fmt: Union[str, unicode]) -> str: ...
|
||||
def __format__(self, fmt: AnyStr) -> AnyStr: ...
|
||||
def isoformat(self) -> str: ...
|
||||
def timetuple(self) -> struct_time: ...
|
||||
def toordinal(self) -> int: ...
|
||||
@@ -84,12 +84,12 @@ class time:
|
||||
def __hash__(self) -> int: ...
|
||||
def isoformat(self) -> str: ...
|
||||
def strftime(self, fmt: Union[str, unicode]) -> str: ...
|
||||
def __format__(self, fmt: str) -> str: ...
|
||||
def __format__(self, fmt: AnyStr) -> AnyStr: ...
|
||||
def utcoffset(self) -> Optional[timedelta]: ...
|
||||
def tzname(self) -> Optional[str]: ...
|
||||
def dst(self) -> Optional[int]: ...
|
||||
def replace(self, hour: int = ..., minute: int = ..., second: int = ...,
|
||||
microsecond: int = ..., tzinfo: Union[_tzinfo, bool] = ...) -> time: ...
|
||||
microsecond: int = ..., tzinfo: Optional[_tzinfo] = ...) -> time: ...
|
||||
|
||||
_date = date
|
||||
_time = time
|
||||
@@ -114,7 +114,7 @@ class timedelta(SupportsAbs[timedelta]):
|
||||
def __add__(self, other: timedelta) -> timedelta: ...
|
||||
def __radd__(self, other: timedelta) -> timedelta: ...
|
||||
def __sub__(self, other: timedelta) -> timedelta: ...
|
||||
def __rsub(self, other: timedelta) -> timedelta: ...
|
||||
def __rsub__(self, other: timedelta) -> timedelta: ...
|
||||
def __neg__(self) -> timedelta: ...
|
||||
def __pos__(self) -> timedelta: ...
|
||||
def __abs__(self) -> timedelta: ...
|
||||
@@ -135,7 +135,7 @@ class timedelta(SupportsAbs[timedelta]):
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class datetime(object):
|
||||
# TODO: is actually subclass of date, but __le__, __lt__, __ge__, __gt__ don't work with date.
|
||||
# TODO: is actually subclass of date, but __le__, __lt__, __ge__, __gt__, __sub__ don't work with date.
|
||||
min = ... # type: datetime
|
||||
max = ... # type: datetime
|
||||
resolution = ... # type: timedelta
|
||||
@@ -143,6 +143,9 @@ class datetime(object):
|
||||
def __init__(self, year: int, month: int, day: int, hour: int = ...,
|
||||
minute: int = ..., second: int = ..., microseconds: int = ...,
|
||||
tzinfo: tzinfo = ...) -> None: ...
|
||||
def __new__(cls, year: int, month: int, day: int, hour: int = ...,
|
||||
minute: int = ..., second: int = ..., microseconds: int = ...,
|
||||
tzinfo: tzinfo = ...) -> datetime: ...
|
||||
|
||||
@property
|
||||
def year(self) -> int: ...
|
||||
@@ -176,7 +179,7 @@ class datetime(object):
|
||||
@classmethod
|
||||
def combine(cls, date: date, time: time) -> datetime: ...
|
||||
def strftime(self, fmt: Union[str, unicode]) -> str: ...
|
||||
def __format__(self, fmt: str) -> str: ...
|
||||
def __format__(self, fmt: AnyStr) -> AnyStr: ...
|
||||
def toordinal(self) -> int: ...
|
||||
def timetuple(self) -> struct_time: ...
|
||||
def utctimetuple(self) -> struct_time: ...
|
||||
@@ -185,7 +188,7 @@ class datetime(object):
|
||||
def timetz(self) -> _time: ...
|
||||
def replace(self, year: int = ..., month: int = ..., day: int = ..., hour: int = ...,
|
||||
minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo:
|
||||
Union[_tzinfo, bool] = ...) -> datetime: ...
|
||||
Optional[_tzinfo] = ...) -> datetime: ...
|
||||
def astimezone(self, tz: _tzinfo) -> datetime: ...
|
||||
def ctime(self) -> str: ...
|
||||
def isoformat(self, sep: str = ...) -> str: ...
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
from mypy_extensions import NoReturn
|
||||
from typing import Any, Callable, Dict, Optional, Tuple
|
||||
|
||||
class error(Exception):
|
||||
def __init__(self, *args: Any) -> None: ...
|
||||
|
||||
def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> None: ...
|
||||
def exit() -> NoReturn: ...
|
||||
def get_ident() -> int: ...
|
||||
def allocate_lock() -> LockType: ...
|
||||
def stack_size(size: Optional[int] = ...) -> int: ...
|
||||
|
||||
class LockType(object):
|
||||
locked_status: bool
|
||||
def __init__(self) -> None: ...
|
||||
def acquire(self, waitflag: Optional[bool] = ...) -> bool: ...
|
||||
def __enter__(self, waitflag: Optional[bool] = ...) -> bool: ...
|
||||
def __exit__(self, typ: Any, val: Any, tb: Any) -> None: ...
|
||||
def release(self) -> bool: ...
|
||||
def locked(self) -> bool: ...
|
||||
|
||||
def interrupt_main() -> None: ...
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for email.MIMEText (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
|
||||
class MIMEText(MIMENonMultipart):
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for email._parseaddr (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
def parsedate_tz(data): ...
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Stubs for email.mime.application
|
||||
|
||||
from typing import Callable, Optional, Tuple, Union
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
|
||||
_ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
|
||||
|
||||
class MIMEApplication(MIMENonMultipart):
|
||||
def __init__(self, _data: bytes, _subtype: str = ...,
|
||||
_encoder: Callable[[MIMEApplication], None] = ...,
|
||||
**_params: _ParamsType) -> None: ...
|
||||
@@ -1,6 +1,4 @@
|
||||
# Stubs for email.mime.base (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
# NOTE: This stub is incomplete.
|
||||
|
||||
# import message
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for email.mime.multipart (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from email.mime.base import MIMEBase
|
||||
|
||||
class MIMEMultipart(MIMEBase):
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for email.mime.nonmultipart (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from email.mime.base import MIMEBase
|
||||
|
||||
class MIMENonMultipart(MIMEBase):
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for email.mime.text (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
|
||||
class MIMEText(MIMENonMultipart):
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for email.utils (Python 2)
|
||||
#
|
||||
# Derived from stub automatically generated by stubgen.
|
||||
|
||||
from email._parseaddr import AddressList as _AddressList
|
||||
from email._parseaddr import mktime_tz as mktime_tz
|
||||
from email._parseaddr import parsedate as _parsedate
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import codecs
|
||||
from typing import Text, Tuple
|
||||
|
||||
class IncrementalEncoder(codecs.IncrementalEncoder):
|
||||
pass
|
||||
def encode(self, input: Text, final: bool = ...) -> bytes: ...
|
||||
|
||||
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
|
||||
pass
|
||||
class StreamWriter(codecs.StreamWriter):
|
||||
pass
|
||||
class StreamReader(codecs.StreamReader):
|
||||
pass
|
||||
def _buffer_decode(self, input: bytes, errors: str, final: bool) -> Tuple[Text, int]: ...
|
||||
|
||||
class StreamWriter(codecs.StreamWriter): ...
|
||||
class StreamReader(codecs.StreamReader): ...
|
||||
|
||||
def getregentry() -> codecs.CodecInfo: ...
|
||||
def encode(input: str, errors: str = ...) -> bytes: ...
|
||||
def decode(input: bytes, errors: str = ...) -> str: ...
|
||||
def encode(input: Text, errors: Text = ...) -> bytes: ...
|
||||
def decode(input: bytes, errors: Text = ...) -> Text: ...
|
||||
|
||||
@@ -1,79 +1,48 @@
|
||||
from typing import Any, Tuple, Optional
|
||||
|
||||
class StandardError(Exception): ...
|
||||
class ArithmeticError(StandardError): ...
|
||||
class AssertionError(StandardError): ...
|
||||
class AttributeError(StandardError): ...
|
||||
class BaseException(object):
|
||||
args = ... # type: Tuple[Any, ...]
|
||||
message = ... # type: str
|
||||
def __getslice__(self, start, end) -> Any: ...
|
||||
def __getitem__(self, start, end) -> Any: ...
|
||||
def __unicode__(self) -> unicode: ...
|
||||
class BufferError(StandardError): ...
|
||||
class BytesWarning(Warning): ...
|
||||
class DeprecationWarning(Warning): ...
|
||||
class EOFError(StandardError): ...class EnvironmentError(StandardError):
|
||||
errno = ... # type: int
|
||||
strerror = ... # type: str
|
||||
filename = ... # type: str
|
||||
class Exception(BaseException): ...
|
||||
class FloatingPointError(ArithmeticError): ...
|
||||
class FutureWarning(Warning): ...
|
||||
class GeneratorExit(BaseException): ...
|
||||
class IOError(EnvironmentError): ...
|
||||
class ImportError(StandardError): ...
|
||||
class ImportWarning(Warning): ...
|
||||
class IndentationError(SyntaxError): ...
|
||||
class IndexError(LookupError): ...
|
||||
class KeyError(LookupError): ...
|
||||
class KeyboardInterrupt(BaseException): ...
|
||||
class LookupError(StandardError): ...
|
||||
class MemoryError(StandardError): ...
|
||||
class NameError(StandardError): ...
|
||||
class NotImplementedError(RuntimeError): ...
|
||||
class OSError(EnvironmentError): ...
|
||||
class OverflowError(ArithmeticError): ...
|
||||
class PendingDeprecationWarning(Warning): ...
|
||||
class ReferenceError(StandardError): ...
|
||||
class RuntimeError(StandardError): ...
|
||||
class RuntimeWarning(Warning): ...
|
||||
class StopIteration(Exception): ...
|
||||
class SyntaxError(StandardError):
|
||||
text = ... # type: str
|
||||
print_file_and_line = ... # type: Optional[str]
|
||||
filename = ... # type: str
|
||||
lineno = ... # type: int
|
||||
offset = ... # type: int
|
||||
msg = ... # type: str
|
||||
class SyntaxWarning(Warning): ...
|
||||
class SystemError(StandardError): ...
|
||||
class SystemExit(BaseException):
|
||||
code = ... # type: int
|
||||
class TabError(IndentationError): ...
|
||||
class TypeError(StandardError): ...
|
||||
class UnboundLocalError(NameError): ...
|
||||
class UnicodeError(ValueError): ...
|
||||
class UnicodeDecodeError(UnicodeError):
|
||||
start = ... # type: int
|
||||
reason = ... # type: str
|
||||
object = ... # type: str
|
||||
end = ... # type: int
|
||||
encoding = ... # type: str
|
||||
class UnicodeEncodeError(UnicodeError):
|
||||
start = ... # type: int
|
||||
reason = ... # type: str
|
||||
object = ... # type: unicode
|
||||
end = ... # type: int
|
||||
encoding = ... # type: str
|
||||
class UnicodeTranslateError(UnicodeError):
|
||||
start = ... # type: int
|
||||
reason = ... # type: str
|
||||
object = ... # type: Any
|
||||
end = ... # type: int
|
||||
encoding = ... # type: str
|
||||
class UnicodeWarning(Warning): ...
|
||||
class UserWarning(Warning): ...
|
||||
class ValueError(StandardError): ...
|
||||
class Warning(Exception): ...
|
||||
class ZeroDivisionError(ArithmeticError): ...
|
||||
from __builtin__ import ArithmeticError as ArithmeticError
|
||||
from __builtin__ import AssertionError as AssertionError
|
||||
from __builtin__ import AttributeError as AttributeError
|
||||
from __builtin__ import BaseException as BaseException
|
||||
from __builtin__ import BufferError as BufferError
|
||||
from __builtin__ import BytesWarning as BytesWarning
|
||||
from __builtin__ import DeprecationWarning as DeprecationWarning
|
||||
from __builtin__ import EOFError as EOFError
|
||||
from __builtin__ import EnvironmentError as EnvironmentError
|
||||
from __builtin__ import Exception as Exception
|
||||
from __builtin__ import FloatingPointError as FloatingPointError
|
||||
from __builtin__ import FutureWarning as FutureWarning
|
||||
from __builtin__ import GeneratorExit as GeneratorExit
|
||||
from __builtin__ import IOError as IOError
|
||||
from __builtin__ import ImportError as ImportError
|
||||
from __builtin__ import ImportWarning as ImportWarning
|
||||
from __builtin__ import IndentationError as IndentationError
|
||||
from __builtin__ import IndexError as IndexError
|
||||
from __builtin__ import KeyError as KeyError
|
||||
from __builtin__ import KeyboardInterrupt as KeyboardInterrupt
|
||||
from __builtin__ import LookupError as LookupError
|
||||
from __builtin__ import MemoryError as MemoryError
|
||||
from __builtin__ import NameError as NameError
|
||||
from __builtin__ import NotImplementedError as NotImplementedError
|
||||
from __builtin__ import OSError as OSError
|
||||
from __builtin__ import OverflowError as OverflowError
|
||||
from __builtin__ import PendingDeprecationWarning as PendingDeprecationWarning
|
||||
from __builtin__ import ReferenceError as ReferenceError
|
||||
from __builtin__ import RuntimeError as RuntimeError
|
||||
from __builtin__ import RuntimeWarning as RuntimeWarning
|
||||
from __builtin__ import StandardError as StandardError
|
||||
from __builtin__ import StopIteration as StopIteration
|
||||
from __builtin__ import SyntaxError as SyntaxError
|
||||
from __builtin__ import SyntaxWarning as SyntaxWarning
|
||||
from __builtin__ import SystemError as SystemError
|
||||
from __builtin__ import SystemExit as SystemExit
|
||||
from __builtin__ import TabError as TabError
|
||||
from __builtin__ import TypeError as TypeError
|
||||
from __builtin__ import UnboundLocalError as UnboundLocalError
|
||||
from __builtin__ import UnicodeError as UnicodeError
|
||||
from __builtin__ import UnicodeDecodeError as UnicodeDecodeError
|
||||
from __builtin__ import UnicodeEncodeError as UnicodeEncodeError
|
||||
from __builtin__ import UnicodeTranslateError as UnicodeTranslateError
|
||||
from __builtin__ import UnicodeWarning as UnicodeWarning
|
||||
from __builtin__ import UserWarning as UserWarning
|
||||
from __builtin__ import ValueError as ValueError
|
||||
from __builtin__ import Warning as Warning
|
||||
from __builtin__ import ZeroDivisionError as ZeroDivisionError
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Union
|
||||
from typing import Any, Union, IO
|
||||
import io
|
||||
|
||||
FASYNC = ... # type: int
|
||||
@@ -72,7 +72,7 @@ LOCK_SH = ... # type: int
|
||||
LOCK_UN = ... # type: int
|
||||
LOCK_WRITE = ... # type: int
|
||||
|
||||
_ANYFILE = Union[int, io.IOBase]
|
||||
_ANYFILE = Union[int, IO]
|
||||
|
||||
# TODO All these return either int or bytes depending on the value of
|
||||
# cmd (not on the type of arg).
|
||||
|
||||
@@ -21,7 +21,7 @@ WRAPPER_ASSIGNMENTS = ... # type: Sequence[str]
|
||||
WRAPPER_UPDATES = ... # type: Sequence[str]
|
||||
|
||||
def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ...,
|
||||
updated: Sequence[str] = ...) -> None: ...
|
||||
updated: Sequence[str] = ...) -> _AnyCallable: ...
|
||||
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...
|
||||
def total_ordering(cls: type) -> type: ...
|
||||
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
# Stubs for genericpath (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
from typing import AnyStr, List
|
||||
|
||||
class _unicode: ...
|
||||
|
||||
def exists(path): ...
|
||||
def isfile(path): ...
|
||||
def isdir(s): ...
|
||||
def getsize(filename): ...
|
||||
def getmtime(filename): ...
|
||||
def getatime(filename): ...
|
||||
def getctime(filename): ...
|
||||
def commonprefix(m): ...
|
||||
def commonprefix(list: List[AnyStr]) -> AnyStr: ...
|
||||
def exists(path: unicode) -> bool: ...
|
||||
def getatime(path: unicode) -> float: ...
|
||||
def getmtime(path: unicode) -> float: ...
|
||||
def getctime(path: unicode) -> float: ...
|
||||
def getsize(path: unicode) -> int: ...
|
||||
def isfile(path: unicode) -> bool: ...
|
||||
def isdir(path: unicode) -> bool: ...
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
from typing import List, Iterator, AnyStr
|
||||
from typing import List, Iterator, Union, AnyStr
|
||||
|
||||
def glob(pathname: AnyStr) -> List[AnyStr]: ...
|
||||
def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ...
|
||||
def glob1(dirname: Union[str, unicode], pattern: AnyStr) -> List[AnyStr]: ...
|
||||
def glob0(dirname: Union[str, unicode], basename: AnyStr) -> List[AnyStr]: ...
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
# Stubs for gzip (Python 2)
|
||||
#
|
||||
# NOTE: Based on a dynamically typed stub automatically generated by stubgen.
|
||||
|
||||
from typing import Any, IO
|
||||
from typing import Any, IO, Text
|
||||
import io
|
||||
|
||||
class GzipFile(io.BufferedIOBase):
|
||||
@@ -18,7 +14,7 @@ class GzipFile(io.BufferedIOBase):
|
||||
fileobj = ... # type: Any
|
||||
offset = ... # type: Any
|
||||
mtime = ... # type: Any
|
||||
def __init__(self, filename: str = ..., mode: str = ..., compresslevel: int = ...,
|
||||
def __init__(self, filename: str = ..., mode: Text = ..., compresslevel: int = ...,
|
||||
fileobj: IO[str] = ..., mtime: float = ...) -> None: ...
|
||||
@property
|
||||
def filename(self): ...
|
||||
@@ -38,4 +34,4 @@ class GzipFile(io.BufferedIOBase):
|
||||
def seek(self, offset, whence=...): ...
|
||||
def readline(self, size=...): ...
|
||||
|
||||
def open(filename: str, mode: str = ..., compresslevel: int = ...) -> GzipFile: ...
|
||||
def open(filename: str, mode: Text = ..., compresslevel: int = ...) -> GzipFile: ...
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
from typing import Tuple, Union
|
||||
|
||||
_DataType = Union[str, bytearray, buffer, memoryview]
|
||||
_DataType = Union[str, unicode, bytearray, buffer, memoryview]
|
||||
|
||||
class _hash(object):
|
||||
# This is not actually in the module namespace.
|
||||
digest_size = 0
|
||||
class _hash(object): # This is not actually in the module namespace.
|
||||
name = ... # type: str
|
||||
block_size = 0
|
||||
digest_size = 0
|
||||
digestsize = 0
|
||||
def __init__(self, arg: _DataType = ...) -> None: ...
|
||||
def update(self, arg: _DataType) -> None: ...
|
||||
def digest(self) -> str: ...
|
||||
def hexdigest(self) -> str: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import TypeVar, List, Iterable, Any, Callable
|
||||
from typing import TypeVar, List, Iterable, Any, Callable, Optional
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
@@ -11,5 +11,6 @@ def heapify(x: List[_T]) -> None: ...
|
||||
def heapreplace(heap: List[_T], item: _T) -> _T:
|
||||
raise IndexError() # if heap is empty
|
||||
def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ...
|
||||
def nlargest(n: int, iterable: Iterable[_T]) -> List[_T]: ...
|
||||
def nlargest(n: int, iterable: Iterable[_T],
|
||||
key: Optional[Callable[[_T], Any]] = ...) -> List[_T]: ...
|
||||
def nsmallest(n: int, iterable: Iterable[_T]) -> List[_T]: ...
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for htmlentitydefs (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Mapping
|
||||
|
||||
name2codepoint = ... # type: Mapping[str, int]
|
||||
|
||||
@@ -18,7 +18,7 @@ def ismodule(object: object) -> bool: ...
|
||||
def isclass(object: object) -> bool: ...
|
||||
def ismethod(object: object) -> bool: ...
|
||||
def isfunction(object: object) -> bool: ...
|
||||
def isisgeneratorfunction(object: object) -> bool: ...
|
||||
def isgeneratorfunction(object: object) -> bool: ...
|
||||
def isgenerator(object: object) -> bool: ...
|
||||
def istraceback(object: object) -> bool: ...
|
||||
def isframe(object: object) -> bool: ...
|
||||
|
||||
@@ -5,101 +5,41 @@
|
||||
# Only a subset of functionality is included.
|
||||
|
||||
from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Any, Union, Optional
|
||||
import _io
|
||||
|
||||
DEFAULT_BUFFER_SIZE = 0
|
||||
from _io import BlockingIOError as BlockingIOError
|
||||
from _io import BufferedRWPair as BufferedRWPair
|
||||
from _io import BufferedRandom as BufferedRandom
|
||||
from _io import BufferedReader as BufferedReader
|
||||
from _io import BufferedWriter as BufferedWriter
|
||||
from _io import BytesIO as BytesIO
|
||||
from _io import DEFAULT_BUFFER_SIZE as DEFAULT_BUFFER_SIZE
|
||||
from _io import FileIO as FileIO
|
||||
from _io import IncrementalNewlineDecoder as IncrementalNewlineDecoder
|
||||
from _io import StringIO as StringIO
|
||||
from _io import TextIOWrapper as TextIOWrapper
|
||||
from _io import UnsupportedOperation as UnsupportedOperation
|
||||
from _io import open as open
|
||||
|
||||
def open(file: Union[str, unicode, int],
|
||||
def _OpenWrapper(file: Union[str, unicode, int],
|
||||
mode: unicode = ..., buffering: int = ..., encoding: unicode = ...,
|
||||
errors: unicode = ..., newline: unicode = ...,
|
||||
closefd: bool = ...) -> IO[Any]: ...
|
||||
|
||||
class IOBase:
|
||||
# TODO
|
||||
...
|
||||
SEEK_SET = ... # type: int
|
||||
SEEK_CUR = ... # type: int
|
||||
SEEK_END = ... # type: int
|
||||
|
||||
class BytesIO(BinaryIO):
|
||||
def __init__(self, initial_bytes: str = ...) -> None: ...
|
||||
# TODO getbuffer
|
||||
# TODO see comments in BinaryIO for missing functionality
|
||||
def close(self) -> None: ...
|
||||
def closed(self) -> bool: ...
|
||||
def fileno(self) -> int: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def read(self, n: int = ...) -> str: ...
|
||||
def readable(self) -> bool: ...
|
||||
def readline(self, limit: int = ...) -> str: ...
|
||||
def readlines(self, hint: int = ...) -> List[str]: ...
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def tell(self) -> int: ...
|
||||
def truncate(self, size: Optional[int] = ...) -> int: ...
|
||||
def writable(self) -> bool: ...
|
||||
def write(self, s: str) -> int: ...
|
||||
def writelines(self, lines: Iterable[str]) -> None: ...
|
||||
def getvalue(self) -> str: ...
|
||||
def read1(self) -> str: ...
|
||||
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def next(self) -> str: ...
|
||||
def __enter__(self) -> 'BytesIO': ...
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
class IOBase(_io._IOBase): ...
|
||||
|
||||
class StringIO(TextIO):
|
||||
def __init__(self, initial_value: unicode = ...,
|
||||
newline: unicode = ...) -> None: ...
|
||||
# TODO see comments in BinaryIO for missing functionality
|
||||
name = ... # type: str
|
||||
def close(self) -> None: ...
|
||||
def closed(self) -> bool: ...
|
||||
def fileno(self) -> int: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def read(self, n: int = ...) -> unicode: ...
|
||||
def readable(self) -> bool: ...
|
||||
def readline(self, limit: int = ...) -> unicode: ...
|
||||
def readlines(self, hint: int = ...) -> List[unicode]: ...
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def tell(self) -> int: ...
|
||||
def truncate(self, size: Optional[int] = ...) -> int: ...
|
||||
def writable(self) -> bool: ...
|
||||
def write(self, s: unicode) -> int: ...
|
||||
def writelines(self, lines: Iterable[unicode]) -> None: ...
|
||||
def getvalue(self) -> unicode: ...
|
||||
class RawIOBase(_io._RawIOBase, IOBase):
|
||||
pass
|
||||
|
||||
def __iter__(self) -> Iterator[unicode]: ...
|
||||
def next(self) -> unicode: ...
|
||||
def __enter__(self) -> 'StringIO': ...
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
class BufferedIOBase(_io._BufferedIOBase, IOBase):
|
||||
pass
|
||||
|
||||
class TextIOWrapper(TextIO):
|
||||
# write_through is undocumented but used by subprocess
|
||||
def __init__(self, buffer: IO[str], encoding: unicode = ...,
|
||||
errors: unicode = ..., newline: unicode = ...,
|
||||
line_buffering: bool = ...,
|
||||
write_through: bool = ...) -> None: ...
|
||||
# TODO see comments in BinaryIO for missing functionality
|
||||
def close(self) -> None: ...
|
||||
def closed(self) -> bool: ...
|
||||
def fileno(self) -> int: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def read(self, n: int = ...) -> unicode: ...
|
||||
def readable(self) -> bool: ...
|
||||
def readline(self, limit: int = ...) -> unicode: ...
|
||||
def readlines(self, hint: int = ...) -> List[unicode]: ...
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def tell(self) -> int: ...
|
||||
def truncate(self, size: Optional[int] = ...) -> int: ...
|
||||
def writable(self) -> bool: ...
|
||||
def write(self, s: unicode) -> int: ...
|
||||
def writelines(self, lines: Iterable[unicode]) -> None: ...
|
||||
|
||||
def __iter__(self) -> Iterator[unicode]: ...
|
||||
def next(self) -> unicode: ...
|
||||
def __enter__(self) -> StringIO: ...
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
|
||||
class BufferedIOBase(IOBase): ...
|
||||
# Note: In the actual io.py, TextIOBase subclasses IOBase.
|
||||
# (Which we don't do here because we don't want to subclass both TextIO and BinaryIO.)
|
||||
class TextIOBase(_io._TextIOBase):
|
||||
pass
|
||||
|
||||
@@ -26,9 +26,9 @@ class chain(Iterator[_T], Generic[_T]):
|
||||
def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ...
|
||||
def dropwhile(predicate: Callable[[_T], Any],
|
||||
iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
def ifilter(predicate: Callable[[_T], Any],
|
||||
def ifilter(predicate: Optional[Callable[[_T], Any]],
|
||||
iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
def ifilterfalse(predicate: Callable[[_T], Any],
|
||||
def ifilterfalse(predicate: Optional[Callable[[_T], Any]],
|
||||
iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
|
||||
@overload
|
||||
@@ -40,7 +40,7 @@ def groupby(iterable: Iterable[_T],
|
||||
@overload
|
||||
def islice(iterable: Iterable[_T], stop: int) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def islice(iterable: Iterable[_T], start: int, stop: Optional[int],
|
||||
def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int],
|
||||
step: int = ...) -> Iterator[_T]: ...
|
||||
|
||||
_T1 = TypeVar('_T1')
|
||||
@@ -60,7 +60,7 @@ def imap(func: Callable[[_T1, _T2], _S],
|
||||
def starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: ...
|
||||
def takewhile(predicate: Callable[[_T], Any],
|
||||
iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
def tee(iterable: Iterable[Any], n: int = ...) -> Iterator[Any]: ...
|
||||
def tee(iterable: Iterable[_T], n: int = ...) -> Tuple[Iterator[_T], ...]: ...
|
||||
|
||||
@overload
|
||||
def izip(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
|
||||
@@ -93,9 +93,43 @@ def izip(iter1: Iterable[Any], iter2: Iterable[Any],
|
||||
def izip_longest(*p: Iterable[Any],
|
||||
fillvalue: Any = ...) -> Iterator[Any]: ...
|
||||
|
||||
# TODO: Return type should be Iterator[Tuple[..]], but unknown tuple shape.
|
||||
# Iterator[Sequence[_T]] loses this type information.
|
||||
def product(*p: Iterable[_T], repeat: int = ...) -> Iterator[Sequence[_T]]: ...
|
||||
@overload
|
||||
def product(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
|
||||
@overload
|
||||
def product(iter1: Iterable[_T1],
|
||||
iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
|
||||
@overload
|
||||
def product(iter1: Iterable[_T1],
|
||||
iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
|
||||
@overload
|
||||
def product(iter1: Iterable[_T1],
|
||||
iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ...
|
||||
@overload
|
||||
def product(iter1: Iterable[_T1],
|
||||
iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4],
|
||||
iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||
@overload
|
||||
def product(iter1: Iterable[_T1],
|
||||
iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4],
|
||||
iter5: Iterable[_T5],
|
||||
iter6: Iterable[_T6]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...
|
||||
@overload
|
||||
def product(iter1: Iterable[Any],
|
||||
iter2: Iterable[Any],
|
||||
iter3: Iterable[Any],
|
||||
iter4: Iterable[Any],
|
||||
iter5: Iterable[Any],
|
||||
iter6: Iterable[Any],
|
||||
iter7: Iterable[Any], *iterables: Iterable) -> Iterator[Tuple]: ...
|
||||
@overload
|
||||
def product(*iter: Iterable[_T], repeat: int) -> Iterator[Tuple[_T, ...]]: ...
|
||||
|
||||
def permutations(iterable: Iterable[_T],
|
||||
r: int = ...) -> Iterator[Sequence[_T]]: ...
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
posixpath.pyi
|
||||
@@ -1,11 +1,6 @@
|
||||
# Stubs for Python 2.7 md5 stdlib module
|
||||
|
||||
class md5(object):
|
||||
def update(self, arg: str) -> None: ...
|
||||
def digest(self) -> str: ...
|
||||
def hexdigest(self) -> str: ...
|
||||
def copy(self) -> md5: ...
|
||||
from hashlib import md5 as md5, md5 as new
|
||||
|
||||
def new(string: str = ...) -> md5: ...
|
||||
blocksize = 0
|
||||
digest_size = 0
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for mimetools (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
import rfc822
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for multiprocessing (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from multiprocessing.process import Process as Process, current_process as current_process, active_children as active_children
|
||||
from multiprocessing.util import SUBDEBUG as SUBDEBUG, SUBWARNING as SUBWARNING
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for multiprocessing.process (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
def current_process(): ...
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for multiprocessing.util (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
import threading
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# Source: https://hg.python.org/cpython/file/2.7/Lib/mutex.py
|
||||
|
||||
from collections import deque
|
||||
from typing import Any, Callable, TypeVar
|
||||
|
||||
_ArgType = TypeVar('_ArgType')
|
||||
|
||||
class mutex:
|
||||
locked = ... # type: bool
|
||||
queue = ... # type: deque
|
||||
def __init__(self) -> None: ...
|
||||
def test(self) -> bool: ...
|
||||
def testandset(self) -> bool: ...
|
||||
def lock(self, function: Callable[[_ArgType], Any], argument: _ArgType) -> None: ...
|
||||
def unlock(self) -> None: ...
|
||||
@@ -0,0 +1 @@
|
||||
posixpath.pyi
|
||||
@@ -0,0 +1,4 @@
|
||||
from typing import AnyStr
|
||||
|
||||
def url2pathname(url: AnyStr) -> AnyStr: ...
|
||||
def pathname2url(p: AnyStr) -> AnyStr: ...
|
||||
@@ -1,103 +1,133 @@
|
||||
# created from https://docs.python.org/2/library/os.html
|
||||
# Stubs for os
|
||||
# Ron Murawski <ron@horizonchess.com>
|
||||
|
||||
from builtins import OSError as error
|
||||
from io import TextIOWrapper as _TextIOWrapper
|
||||
from posix import stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
|
||||
import sys
|
||||
from typing import (
|
||||
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr,
|
||||
Optional, Generic, Set, Callable, Text, Sequence, IO, NamedTuple
|
||||
Optional, Generic, Set, Callable, Text, Sequence, IO, NamedTuple, TypeVar
|
||||
)
|
||||
from . import path
|
||||
from . import path as path
|
||||
from mypy_extensions import NoReturn
|
||||
|
||||
error = OSError
|
||||
SEEK_SET = 0
|
||||
SEEK_CUR = 0
|
||||
SEEK_END = 0
|
||||
_T = TypeVar('_T')
|
||||
|
||||
# More constants, copied from stdlib/3/os/__init__.pyi
|
||||
O_RDONLY = 0
|
||||
O_WRONLY = 0
|
||||
O_RDWR = 0
|
||||
O_APPEND = 0
|
||||
O_CREAT = 0
|
||||
O_EXCL = 0
|
||||
O_TRUNC = 0
|
||||
O_DSYNC = 0 # Unix only
|
||||
O_RSYNC = 0 # Unix only
|
||||
O_SYNC = 0 # Unix only
|
||||
O_NDELAY = 0 # Unix only
|
||||
O_NONBLOCK = 0 # Unix only
|
||||
O_NOCTTY = 0 # Unix only
|
||||
O_SHLOCK = 0 # Unix only
|
||||
O_EXLOCK = 0 # Unix only
|
||||
O_BINARY = 0 # Windows only
|
||||
O_NOINHERIT = 0 # Windows only
|
||||
O_SHORT_LIVED = 0 # Windows only
|
||||
O_TEMPORARY = 0 # Windows only
|
||||
O_RANDOM = 0 # Windows only
|
||||
O_SEQUENTIAL = 0 # Windows only
|
||||
O_TEXT = 0 # Windows only
|
||||
O_ASYNC = 0 # Gnu extension if in C library
|
||||
O_DIRECT = 0 # Gnu extension if in C library
|
||||
O_DIRECTORY = 0 # Gnu extension if in C library
|
||||
O_NOFOLLOW = 0 # Gnu extension if in C library
|
||||
O_NOATIME = 0 # Gnu extension if in C library
|
||||
O_LARGEFILE = 0 # Gnu extension if in C library
|
||||
# ----- os variables -----
|
||||
|
||||
curdir = ... # type: str
|
||||
pardir = ... # type: str
|
||||
sep = ... # type: str
|
||||
altsep = ... # type: str
|
||||
extsep = ... # type: str
|
||||
pathsep = ... # type: str
|
||||
defpath = ... # type: str
|
||||
linesep = ... # type: str
|
||||
devnull = ... # type: str
|
||||
name = ... # type: str
|
||||
if sys.version_info >= (3, 2):
|
||||
supports_bytes_environ: bool
|
||||
|
||||
F_OK = 0
|
||||
R_OK = 0
|
||||
W_OK = 0
|
||||
X_OK = 0
|
||||
if sys.version_info >= (3, 3):
|
||||
supports_dir_fd: Set[Callable[..., Any]]
|
||||
supports_fd: Set[Callable[..., Any]]
|
||||
supports_effective_ids: Set[Callable[..., Any]]
|
||||
supports_follow_symlinks: Set[Callable[..., Any]]
|
||||
|
||||
class _Environ(MutableMapping[str, str]):
|
||||
def copy(self) -> Dict[str, str]: ...
|
||||
SEEK_SET: int
|
||||
SEEK_CUR: int
|
||||
SEEK_END: int
|
||||
|
||||
environ = ... # type: _Environ
|
||||
confstr_names = ... # type: Mapping[str, int] # Unix only
|
||||
pathconf_names = ... # type: Mapping[str, int] # Unix only
|
||||
sysconf_names = ... # type: Mapping[str, int] # Unix only
|
||||
EX_OK = 0 # Unix only
|
||||
EX_USAGE = 0 # Unix only
|
||||
EX_DATAERR = 0 # Unix only
|
||||
EX_NOINPUT = 0 # Unix only
|
||||
EX_NOUSER = 0 # Unix only
|
||||
EX_NOHOST = 0 # Unix only
|
||||
EX_UNAVAILABLE = 0 # Unix only
|
||||
EX_SOFTWARE = 0 # Unix only
|
||||
EX_OSERR = 0 # Unix only
|
||||
EX_OSFILE = 0 # Unix only
|
||||
EX_CANTCREAT = 0 # Unix only
|
||||
EX_IOERR = 0 # Unix only
|
||||
EX_TEMPFAIL = 0 # Unix only
|
||||
EX_PROTOCOL = 0 # Unix only
|
||||
EX_NOPERM = 0 # Unix only
|
||||
EX_CONFIG = 0 # Unix only
|
||||
P_NOWAIT = 0
|
||||
P_NOWAITO = 0
|
||||
P_WAIT = 0
|
||||
# P_DETACH = 0 # Windows only
|
||||
# P_OVERLAY = 0 # Windows only
|
||||
O_RDONLY: int
|
||||
O_WRONLY: int
|
||||
O_RDWR: int
|
||||
O_APPEND: int
|
||||
O_CREAT: int
|
||||
O_EXCL: int
|
||||
O_TRUNC: int
|
||||
O_DSYNC: int # Unix only
|
||||
O_RSYNC: int # Unix only
|
||||
O_SYNC: int # Unix only
|
||||
O_NDELAY: int # Unix only
|
||||
O_NONBLOCK: int # Unix only
|
||||
O_NOCTTY: int # Unix only
|
||||
O_SHLOCK: int # Unix only
|
||||
O_EXLOCK: int # Unix only
|
||||
O_BINARY: int # Windows only
|
||||
O_NOINHERIT: int # Windows only
|
||||
O_SHORT_LIVED: int # Windows only
|
||||
O_TEMPORARY: int # Windows only
|
||||
O_RANDOM: int # Windows only
|
||||
O_SEQUENTIAL: int # Windows only
|
||||
O_TEXT: int # Windows only
|
||||
O_ASYNC: int # Gnu extension if in C library
|
||||
O_DIRECT: int # Gnu extension if in C library
|
||||
O_DIRECTORY: int # Gnu extension if in C library
|
||||
O_NOFOLLOW: int # Gnu extension if in C library
|
||||
O_NOATIME: int # Gnu extension if in C library
|
||||
O_LARGEFILE: int # Gnu extension if in C library
|
||||
|
||||
curdir: str
|
||||
pardir: str
|
||||
sep: str
|
||||
altsep: str
|
||||
extsep: str
|
||||
pathsep: str
|
||||
defpath: str
|
||||
linesep: str
|
||||
devnull: str
|
||||
name: str
|
||||
|
||||
F_OK: int
|
||||
R_OK: int
|
||||
W_OK: int
|
||||
X_OK: int
|
||||
|
||||
class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]):
|
||||
def copy(self) -> Dict[AnyStr, AnyStr]: ...
|
||||
|
||||
environ: _Environ[str]
|
||||
if sys.version_info >= (3, 2):
|
||||
environb: _Environ[bytes]
|
||||
|
||||
confstr_names: Dict[str, int] # Unix only
|
||||
pathconf_names: Dict[str, int] # Unix only
|
||||
sysconf_names: Dict[str, int] # Unix only
|
||||
|
||||
EX_OK: int # Unix only
|
||||
EX_USAGE: int # Unix only
|
||||
EX_DATAERR: int # Unix only
|
||||
EX_NOINPUT: int # Unix only
|
||||
EX_NOUSER: int # Unix only
|
||||
EX_NOHOST: int # Unix only
|
||||
EX_UNAVAILABLE: int # Unix only
|
||||
EX_SOFTWARE: int # Unix only
|
||||
EX_OSERR: int # Unix only
|
||||
EX_OSFILE: int # Unix only
|
||||
EX_CANTCREAT: int # Unix only
|
||||
EX_IOERR: int # Unix only
|
||||
EX_TEMPFAIL: int # Unix only
|
||||
EX_PROTOCOL: int # Unix only
|
||||
EX_NOPERM: int # Unix only
|
||||
EX_CONFIG: int # Unix only
|
||||
EX_NOTFOUND: int # Unix only
|
||||
|
||||
P_NOWAIT: int
|
||||
P_NOWAITO: int
|
||||
P_WAIT: int
|
||||
if sys.platform == 'win32':
|
||||
P_DETACH: int # Windows only
|
||||
P_OVERLAY: int # Windows only
|
||||
|
||||
# wait()/waitpid() options
|
||||
WNOHANG = 0 # Unix only
|
||||
WCONTINUED = 0 # some Unix systems
|
||||
WUNTRACED = 0 # Unix only
|
||||
WNOHANG: int # Unix only
|
||||
WCONTINUED: int # some Unix systems
|
||||
WUNTRACED: int # Unix only
|
||||
|
||||
TMP_MAX: int # Undocumented, but used by tempfile
|
||||
|
||||
# ----- os classes (structures) -----
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike as PathLike # See comment in builtins
|
||||
|
||||
_PathType = path._PathType
|
||||
|
||||
TMP_MAX = 0 # Undocumented, but used by tempfile
|
||||
_PathType = Union[bytes, Text]
|
||||
_StatVFS = NamedTuple('_StatVFS', [('f_bsize', int), ('f_frsize', int), ('f_blocks', int),
|
||||
('f_bfree', int), ('f_bavail', int), ('f_files', int),
|
||||
('f_ffree', int), ('f_favail', int), ('f_flag', int),
|
||||
('f_namemax', int)])
|
||||
|
||||
def ctermid() -> str: ... # Unix only
|
||||
def getegid() -> int: ... # Unix only
|
||||
def geteuid() -> int: ... # Unix only
|
||||
@@ -112,8 +142,6 @@ def getppid() -> int: ...
|
||||
def getresuid() -> Tuple[int, int, int]: ... # Unix only
|
||||
def getresgid() -> Tuple[int, int, int]: ... # Unix only
|
||||
def getuid() -> int: ... # Unix only
|
||||
def getenv(varname: unicode, value: unicode = ...) -> str: ...
|
||||
def putenv(varname: unicode, value: unicode) -> None: ...
|
||||
def setegid(egid: int) -> None: ... # Unix only
|
||||
def seteuid(euid: int) -> None: ... # Unix only
|
||||
def setgid(gid: int) -> None: ... # Unix only
|
||||
@@ -130,7 +158,14 @@ def setuid(uid: int) -> None: ... # Unix only
|
||||
def strerror(code: int) -> str: ...
|
||||
def umask(mask: int) -> int: ...
|
||||
def uname() -> Tuple[str, str, str, str, str]: ... # Unix only
|
||||
def unsetenv(varname: str) -> None: ...
|
||||
|
||||
@overload
|
||||
def getenv(key: Text) -> Optional[str]: ...
|
||||
@overload
|
||||
def getenv(key: Text, default: _T) -> Union[str, _T]: ...
|
||||
def putenv(key: Union[bytes, Text], value: Union[bytes, Text]) -> None: ...
|
||||
def unsetenv(key: Union[bytes, Text]) -> None: ...
|
||||
|
||||
def fdopen(fd: int, *args, **kwargs) -> IO[Any]: ...
|
||||
def close(fd: int) -> None: ...
|
||||
def closerange(fd_low: int, fd_high: int) -> None: ...
|
||||
@@ -191,12 +226,21 @@ def stat_float_times() -> bool: ...
|
||||
def statvfs(path: _PathType) -> _StatVFS: ... # Unix only
|
||||
def symlink(source: _PathType, link_name: _PathType) -> None: ...
|
||||
def unlink(path: _PathType) -> None: ...
|
||||
def utime(path: _PathType, times: Optional[Tuple[float, float]]) -> None: ...
|
||||
# TODO: add ns, dir_fd, follow_symlinks argument
|
||||
if sys.version_info >= (3, 0):
|
||||
def utime(path: _PathType, times: Optional[Tuple[float, float]] = ...) -> None: ...
|
||||
else:
|
||||
def utime(path: _PathType, times: Optional[Tuple[float, float]]) -> None: ...
|
||||
|
||||
# TODO onerror: function from OSError to void
|
||||
def walk(top: AnyStr, topdown: bool = ..., onerror: Any = ...,
|
||||
followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
|
||||
List[AnyStr]]]: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def walk(top: Union[AnyStr, PathLike[AnyStr]], topdown: bool = ...,
|
||||
onerror: Optional[Callable[[OSError], Any]] = ...,
|
||||
followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
|
||||
List[AnyStr]]]: ...
|
||||
else:
|
||||
def walk(top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ...,
|
||||
followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
|
||||
List[AnyStr]]]: ...
|
||||
|
||||
def abort() -> NoReturn: ...
|
||||
# These are defined as execl(file, *args) but the first *arg is mandatory.
|
||||
@@ -221,11 +265,19 @@ def forkpty() -> Tuple[int, int]: ... # some flavors of Unix
|
||||
def kill(pid: int, sig: int) -> None: ...
|
||||
def killpg(pgid: int, sig: int) -> None: ... # Unix only
|
||||
def nice(increment: int) -> int: ... # Unix only
|
||||
# TODO: plock, popen*, P_*
|
||||
def popen(command: str, *args, **kwargs) -> Optional[IO[Any]]: ...
|
||||
def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
|
||||
def popen3(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any], IO[Any]]: ...
|
||||
def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
|
||||
def plock(op: int) -> None: ... # Unix only ???op is int?
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
class popen(_TextIOWrapper):
|
||||
# TODO 'b' modes or bytes command not accepted?
|
||||
def __init__(self, command: str, mode: str = ...,
|
||||
bufsize: int = ...) -> None: ...
|
||||
def close(self) -> Any: ... # may return int
|
||||
else:
|
||||
def popen(command: str, *args, **kwargs) -> Optional[IO[Any]]: ...
|
||||
def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
|
||||
def popen3(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any], IO[Any]]: ...
|
||||
def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
|
||||
|
||||
def spawnl(mode: int, path: _PathType, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
|
||||
def spawnle(mode: int, path: _PathType, arg0: Union[bytes, Text],
|
||||
@@ -261,10 +313,34 @@ def getloadavg() -> Tuple[float, float, float]: ... # Unix only
|
||||
def sysconf(name: Union[str, int]) -> int: ... # Unix only
|
||||
def urandom(n: int) -> bytes: ...
|
||||
|
||||
def tmpfile() -> IO[Any]: ...
|
||||
def tmpnam() -> str: ...
|
||||
def tempnam(dir: str = ..., prefix: str = ...) -> str: ...
|
||||
if sys.version_info >= (3, 0):
|
||||
def sched_getaffinity(id: int) -> Set[int]: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
class waitresult:
|
||||
si_pid: int
|
||||
def waitid(idtype: int, id: int, options: int) -> waitresult: ...
|
||||
|
||||
P_ALL = 0
|
||||
WEXITED = 0
|
||||
WNOWAIT = 0
|
||||
if sys.version_info < (3, 0):
|
||||
def tmpfile() -> IO[Any]: ...
|
||||
def tmpnam() -> str: ...
|
||||
def tempnam(dir: str = ..., prefix: str = ...) -> str: ...
|
||||
|
||||
P_ALL: int
|
||||
WEXITED: int
|
||||
WNOWAIT: int
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
def sync() -> None: ... # Unix only
|
||||
|
||||
def truncate(path: Union[_PathType, int], length: int) -> None: ... # Unix only up to version 3.4
|
||||
|
||||
def fwalk(top: AnyStr = ..., topdown: bool = ...,
|
||||
onerror: Callable = ..., *, follow_symlinks: bool = ...,
|
||||
dir_fd: int = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
|
||||
List[AnyStr], int]]: ... # Unix only
|
||||
|
||||
terminal_size = NamedTuple('terminal_size', [('columns', int), ('lines', int)])
|
||||
def get_terminal_size(fd: int = ...) -> terminal_size: ...
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
def cpu_count() -> Optional[int]: ...
|
||||
|
||||
@@ -3,8 +3,19 @@
|
||||
|
||||
# based on http://docs.python.org/3.2/library/os.path.html
|
||||
# adapted for 2.7 by Michal Pokorny
|
||||
import sys
|
||||
from typing import (
|
||||
overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO,
|
||||
TypeVar, Union, Text, Callable
|
||||
)
|
||||
|
||||
from typing import overload, List, Any, Tuple, BinaryIO, TextIO, TypeVar, Callable, AnyStr
|
||||
_T = TypeVar('_T')
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike
|
||||
_PathType = Union[bytes, Text, _PathLike]
|
||||
else:
|
||||
_PathType = Union[bytes, Text]
|
||||
|
||||
# ----- os.path variables -----
|
||||
supports_unicode_filenames = False
|
||||
@@ -22,34 +33,60 @@ devnull = ... # type: str
|
||||
def abspath(path: AnyStr) -> AnyStr: ...
|
||||
def basename(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
def commonprefix(list: List[AnyStr]) -> AnyStr: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ...
|
||||
|
||||
# NOTE: Empty lists results in '' (str) regardless of contained type.
|
||||
# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes
|
||||
# So, fall back to Any
|
||||
def commonprefix(list: Sequence[AnyStr]) -> Any: ...
|
||||
|
||||
def dirname(path: AnyStr) -> AnyStr: ...
|
||||
def exists(path: unicode) -> bool: ...
|
||||
def lexists(path: unicode) -> bool: ...
|
||||
def exists(path: _PathType) -> bool: ...
|
||||
def lexists(path: _PathType) -> bool: ...
|
||||
def expanduser(path: AnyStr) -> AnyStr: ...
|
||||
def expandvars(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(path: unicode) -> float: ...
|
||||
def getmtime(path: unicode) -> float: ...
|
||||
def getctime(path: unicode) -> float: ...
|
||||
def getatime(path: _PathType) -> float: ...
|
||||
def getmtime(path: _PathType) -> float: ...
|
||||
def getctime(path: _PathType) -> float: ...
|
||||
|
||||
def getsize(path: unicode) -> int: ...
|
||||
def isabs(path: unicode) -> bool: ...
|
||||
def isfile(path: unicode) -> bool: ...
|
||||
def isdir(path: unicode) -> bool: ...
|
||||
def islink(path: unicode) -> bool: ...
|
||||
def ismount(path: unicode) -> bool: ...
|
||||
def getsize(path: _PathType) -> int: ...
|
||||
def isabs(path: _PathType) -> bool: ...
|
||||
def isfile(path: _PathType) -> bool: ...
|
||||
def isdir(path: _PathType) -> bool: ...
|
||||
def islink(path: _PathType) -> bool: ...
|
||||
def ismount(path: _PathType) -> bool: ...
|
||||
|
||||
def join(path: AnyStr, *paths: AnyStr) -> AnyStr: ...
|
||||
if sys.version_info < (3, 0):
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
# (Since Python 2 allows that, too)
|
||||
# Note that e.g. os.path.join("a", "b", "c", "d", u"e") will still result in
|
||||
# a type error.
|
||||
@overload
|
||||
def join(__p1: bytes, *p: bytes) -> bytes: ...
|
||||
@overload
|
||||
def join(__p1: Text, *p: _PathType) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: Text, *p: _PathType) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: _PathType) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: _PathType) -> Text: ...
|
||||
else:
|
||||
def join(path: AnyStr, *paths: AnyStr) -> AnyStr: ...
|
||||
|
||||
def normcase(path: AnyStr) -> AnyStr: ...
|
||||
def normpath(path: AnyStr) -> AnyStr: ...
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
def relpath(path: AnyStr, start: AnyStr = ...) -> AnyStr: ...
|
||||
if sys.platform == 'win32':
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
else:
|
||||
def realpath(filename: AnyStr) -> AnyStr: ...
|
||||
def relpath(path: AnyStr, start: _PathType = ...) -> AnyStr: ...
|
||||
|
||||
def samefile(path1: unicode, path2: unicode) -> bool: ...
|
||||
def samefile(path1: _PathType, path2: _PathType) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
# TODO
|
||||
# def samestat(stat1: stat_result,
|
||||
@@ -61,5 +98,5 @@ def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # Windows only, deprecated
|
||||
|
||||
_T = TypeVar('_T')
|
||||
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
|
||||
if sys.version_info < (3,):
|
||||
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
posixpath.pyi
|
||||
@@ -0,0 +1,29 @@
|
||||
from typing import Any, Iterable, List, Optional, Union, TextIO, Tuple, TypeVar
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
__all__ = ... # type: List[str]
|
||||
|
||||
class Popen3:
|
||||
sts = ... # type: int
|
||||
cmd = ... # type: Iterable
|
||||
pid = ... # type: int
|
||||
tochild = ... # type: TextIO
|
||||
fromchild = ... # type: TextIO
|
||||
childerr = ... # type: Optional[TextIO]
|
||||
def __init__(self, cmd: Iterable = ..., capturestderr: bool = ..., bufsize: int = ...) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def poll(self, _deadstate: _T = ...) -> Union[int, _T]: ...
|
||||
def wait(self) -> int: ...
|
||||
|
||||
class Popen4(Popen3):
|
||||
childerr = ... # type: None
|
||||
cmd = ... # type: Iterable
|
||||
pid = ... # type: int
|
||||
tochild = ... # type: TextIO
|
||||
fromchild = ... # type: TextIO
|
||||
def __init__(self, cmd: Iterable = ..., bufsize: int = ...) -> None: ...
|
||||
|
||||
def popen2(cmd: Iterable = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
|
||||
def popen3(cmd: Iterable = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO, TextIO]: ...
|
||||
def popen4(cmd: Iterable = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
|
||||
@@ -1,8 +1,4 @@
|
||||
# Stubs for posixpath (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, AnyStr, List
|
||||
from typing import Any
|
||||
from genericpath import * # noqa: F403
|
||||
|
||||
curdir = ... # type: Any
|
||||
@@ -38,13 +34,3 @@ def realpath(filename): ...
|
||||
supports_unicode_filenames = ... # type: Any
|
||||
|
||||
def relpath(path, start=...): ...
|
||||
|
||||
# posixpath imports these from genericpath.py:
|
||||
def commonprefix(list: List[AnyStr]) -> AnyStr: ...
|
||||
def exists(path: unicode) -> bool: ...
|
||||
def getatime(path: unicode) -> float: ...
|
||||
def getmtime(path: unicode) -> float: ...
|
||||
def getctime(path: unicode) -> float: ...
|
||||
def getsize(path: unicode) -> int: ...
|
||||
def isfile(path: unicode) -> bool: ...
|
||||
def isdir(path: unicode) -> bool: ...
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
from typing import Any, AnyStr, Callable, Container, Dict, IO, List, Mapping, MutableMapping, Optional, Tuple, Type, Union
|
||||
from mypy_extensions import NoReturn
|
||||
from repr import Repr
|
||||
|
||||
from types import FunctionType, MethodType, ModuleType, TracebackType
|
||||
# the return type of sys.exc_info(), used by ErrorDuringImport.__init__
|
||||
_Exc_Info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
|
||||
__author__ = ... # type: str
|
||||
__date__ = ... # type: str
|
||||
__version__ = ... # type: str
|
||||
__credits__ = ... # type: str
|
||||
|
||||
def pathdirs() -> List[str]: ...
|
||||
def getdoc(object: object) -> Union[str, unicode]: ...
|
||||
def splitdoc(doc: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def classname(object: object, modname: str) -> str: ...
|
||||
def isdata(object: object) -> bool: ...
|
||||
def replace(text: AnyStr, *pairs: AnyStr) -> AnyStr: ...
|
||||
def cram(text: str, maxlen: int) -> str: ...
|
||||
def stripid(text: str) -> str: ...
|
||||
def allmethods(cl: type) -> MutableMapping[str, MethodType]: ...
|
||||
def visiblename(name: str, all: Optional[Container[str]] = ..., obj: Optional[object] = ...) -> bool: ...
|
||||
def classify_class_attrs(object: object) -> List[Tuple[str, str, type, str]]: ...
|
||||
|
||||
def ispackage(path: str) -> bool: ...
|
||||
def source_synopsis(file: IO[AnyStr]) -> Optional[AnyStr]: ...
|
||||
def synopsis(filename: str, cache: MutableMapping[str, Tuple[int, str]] = ...) -> Optional[str]: ...
|
||||
|
||||
class ErrorDuringImport(Exception):
|
||||
filename = ... # type: str
|
||||
exc = ... # type: Optional[Type[BaseException]]
|
||||
value = ... # type: Optional[BaseException]
|
||||
tb = ... # type: Optional[TracebackType]
|
||||
def __init__(self, filename: str, exc_info: _Exc_Info) -> None: ...
|
||||
|
||||
def importfile(path: str) -> ModuleType: ...
|
||||
def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, ModuleType] = ...) -> ModuleType: ...
|
||||
|
||||
class Doc:
|
||||
def document(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def fail(self, object: object, name: Optional[str] = ..., *args: Any) -> NoReturn: ...
|
||||
def docmodule(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def docclass(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def docroutine(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def docother(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def docproperty(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def docdata(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def getdocloc(self, object: object) -> Optional[str]: ...
|
||||
|
||||
class HTMLRepr(Repr):
|
||||
maxlist = ... # type: int
|
||||
maxtuple = ... # type: int
|
||||
maxdict = ... # type: int
|
||||
maxstring = ... # type: int
|
||||
maxother = ... # type: int
|
||||
def __init__(self) -> None: ...
|
||||
def escape(self, text: str) -> str: ...
|
||||
def repr(self, object: object) -> str: ...
|
||||
def repr1(self, x: object, level: complex) -> str: ...
|
||||
def repr_string(self, x: Union[str, unicode], level: complex) -> str: ...
|
||||
def repr_str(self, x: Union[str, unicode], level: complex) -> str: ...
|
||||
def repr_instance(self, x: object, level: complex) -> str: ...
|
||||
def repr_unicode(self, x: AnyStr, level: complex) -> str: ...
|
||||
|
||||
class HTMLDoc(Doc):
|
||||
def repr(self, object: object) -> str: ...
|
||||
def escape(self, test: str) -> str: ...
|
||||
def page(self, title: str, contents: str) -> str: ...
|
||||
def heading(self, title: str, fgcol: str, bgcol: str, extras: str = ...) -> str: ...
|
||||
def section(self, title: str, fgcol: str, bgcol: str, contents: str, width: int = ..., prelude: str = ..., marginalia: Optional[str] = ..., gap: str = ...) -> str: ...
|
||||
def bigsection(self, title: str, *args) -> str: ...
|
||||
def preformat(self, text: str) -> str: ...
|
||||
def multicolumn(self, list: List[Any], format: Callable[[Any], str], cols: int = ...) -> str: ...
|
||||
def grey(self, text: str) -> str: ...
|
||||
def namelink(self, name: str, *dicts: MutableMapping[str, str]) -> str: ...
|
||||
def classlink(self, object: object, modname: str) -> str: ...
|
||||
def modulelink(self, object: object) -> str: ...
|
||||
def modpkglink(self, data: Tuple[str, str, bool, bool]) -> str: ...
|
||||
def markup(self, text: str, escape: Optional[Callable[[str], str]] = ..., funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ...) -> str: ...
|
||||
def formattree(self, tree: List[Union[Tuple[type, Tuple[type, ...]], list]], modname: str, parent: Optional[type] = ...) -> str: ...
|
||||
def docmodule(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., *ignored) -> str: ...
|
||||
def docclass(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., *ignored) -> str: ...
|
||||
def formatvalue(self, object: object) -> str: ...
|
||||
def docroutine(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ..., cl: Optional[type] = ..., *ignored) -> str: ...
|
||||
def docproperty(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored) -> str: ...
|
||||
def docother(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., *ignored) -> str: ...
|
||||
def docdata(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., cl: Optional[Any] = ..., *ignored) -> str: ...
|
||||
def index(self, dir: str, shadowed: Optional[MutableMapping[str, bool]] = ...) -> str: ...
|
||||
|
||||
class TextRepr(Repr):
|
||||
maxlist = ... # type: int
|
||||
maxtuple = ... # type: int
|
||||
maxdict = ... # type: int
|
||||
maxstring = ... # type: int
|
||||
maxother = ... # type: int
|
||||
def __init__(self) -> None: ...
|
||||
def repr1(self, x: object, level: complex) -> str: ...
|
||||
def repr_string(self, x: str, level: complex) -> str: ...
|
||||
def repr_str(self, x: str, level: complex) -> str: ...
|
||||
def repr_instance(self, x: object, level: complex) -> str: ...
|
||||
|
||||
class TextDoc(Doc):
|
||||
def repr(self, object: object) -> str: ...
|
||||
def bold(self, text: str) -> str: ...
|
||||
def indent(self, text: str, prefix: str = ...) -> str: ...
|
||||
def section(self, title: str, contents: str) -> str: ...
|
||||
def formattree(self, tree: List[Union[Tuple[type, Tuple[type, ...]], list]], modname: str, parent: Optional[type] = ..., prefix: str = ...) -> str: ...
|
||||
def docmodule(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., *ignored) -> str: ...
|
||||
def docclass(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., *ignored) -> str: ...
|
||||
def formatvalue(self, object: object) -> str: ...
|
||||
def docroutine(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored) -> str: ...
|
||||
def docproperty(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., cl: Optional[Any] = ..., *ignored) -> str: ...
|
||||
def docdata(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored) -> str: ...
|
||||
def docother(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., parent: Optional[str] = ..., maxlen: Optional[int] = ..., doc: Optional[Any] = ..., *ignored) -> str: ...
|
||||
|
||||
def pager(text: str) -> None: ...
|
||||
def getpager() -> Callable[[str], None]: ...
|
||||
def plain(text: str) -> str: ...
|
||||
def pipepager(text: str, cmd: str) -> None: ...
|
||||
def tempfilepager(text: str, cmd: str) -> None: ...
|
||||
def ttypager(text: str) -> None: ...
|
||||
def plainpager(text: str) -> None: ...
|
||||
def describe(thing: Any) -> str: ...
|
||||
def locate(path: str, forceload: bool = ...) -> object: ...
|
||||
|
||||
text = ... # type: TextDoc
|
||||
html = ... # type: HTMLDoc
|
||||
|
||||
class _OldStyleClass: ...
|
||||
|
||||
def resolve(thing: Union[str, object], forceload: bool = ...) -> Optional[Tuple[object, str]]: ...
|
||||
def render_doc(thing: Union[str, object], title: str = ..., forceload: bool = ...) -> str: ...
|
||||
def doc(thing: Union[str, object], title: str = ..., forceload: bool = ...) -> None: ...
|
||||
def writedoc(thing: Union[str, object], forceload: bool = ...) -> None: ...
|
||||
def writedocs(dir: str, pkgpath: str = ..., done: Optional[Any] = ...) -> None: ...
|
||||
|
||||
class Helper:
|
||||
keywords = ... # type: Dict[str, Union[str, Tuple[str, str]]]
|
||||
symbols = ... # type: Dict[str, str]
|
||||
topics = ... # type: Dict[str, Union[str, Tuple[str, ...]]]
|
||||
def __init__(self, input: Optional[IO[str]] = ..., output: Optional[IO[str]] = ...) -> None: ...
|
||||
input = ... # type: IO[str]
|
||||
output = ... # type: IO[str]
|
||||
def __call__(self, request: Union[str, Helper, object] = ...) -> None: ...
|
||||
def interact(self) -> None: ...
|
||||
def getline(self, prompt: str) -> str: ...
|
||||
def help(self, request: Any) -> None: ...
|
||||
def intro(self) -> None: ...
|
||||
def list(self, items: List[str], columns: int = ..., width: int = ...) -> None: ...
|
||||
def listkeywords(self) -> None: ...
|
||||
def listsymbols(self) -> None: ...
|
||||
def listtopics(self) -> None: ...
|
||||
def showtopic(self, topic: str, more_xrefs: str = ...) -> None: ...
|
||||
def showsymbol(self, symbol: str) -> None: ...
|
||||
def listmodules(self, key: str = ...) -> None: ...
|
||||
|
||||
help = ... # type: Helper
|
||||
|
||||
# See Python issue #11182: "remove the unused and undocumented pydoc.Scanner class"
|
||||
# class Scanner:
|
||||
# roots = ... # type: Any
|
||||
# state = ... # type: Any
|
||||
# children = ... # type: Any
|
||||
# descendp = ... # type: Any
|
||||
# def __init__(self, roots, children, descendp) -> None: ...
|
||||
# def next(self): ...
|
||||
|
||||
class ModuleScanner:
|
||||
quit = ... # type: bool
|
||||
def run(self, callback: Callable[[Optional[str], str, str], None], key: Optional[Any] = ..., completer: Optional[Callable[[], None]] = ..., onerror: Optional[Callable] = ...) -> None: ...
|
||||
|
||||
def apropos(key: str) -> None: ...
|
||||
def serve(port: int, callback: Optional[Callable[[Any], None]] = ..., completer: Optional[Callable[[], None]] = ...) -> None: ...
|
||||
def gui() -> None: ...
|
||||
def ispath(x: Any) -> bool: ...
|
||||
def cli() -> None: ...
|
||||
@@ -97,3 +97,4 @@ def subn(pattern: Union[Pattern[str], Pattern[unicode]], repl: Callable[[Match[A
|
||||
def escape(string: AnyStr) -> AnyStr: ...
|
||||
|
||||
def purge() -> None: ...
|
||||
def template(pattern: Union[AnyStr, Pattern[AnyStr]], flags: int = ...) -> Pattern[AnyStr]: ...
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for runpy (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class _TempModule:
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
# Stubs for sets (Python 2)
|
||||
from typing import Any, Callable, Hashable, Iterable, Iterator, MutableMapping, Optional, TypeVar, Union
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_Setlike = Union[BaseSet[_T], Iterable[_T]]
|
||||
_SelfT = TypeVar('_SelfT', bound=BaseSet)
|
||||
|
||||
class BaseSet(Iterable[_T]):
|
||||
def __init__(self) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __cmp__(self, other: Any) -> int: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
def copy(self: _SelfT) -> _SelfT: ...
|
||||
def __copy__(self: _SelfT) -> _SelfT: ...
|
||||
def __deepcopy__(self: _SelfT, memo: MutableMapping[int, BaseSet[_T]]) -> _SelfT: ...
|
||||
def __or__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def union(self: _SelfT, other: _Setlike) -> _SelfT: ...
|
||||
def __and__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def intersection(self: _SelfT, other: _Setlike) -> _SelfT: ...
|
||||
def __xor__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def symmetric_difference(self: _SelfT, other: _Setlike) -> _SelfT: ...
|
||||
def __sub__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def difference(self: _SelfT, other: _Setlike) -> _SelfT: ...
|
||||
def __contains__(self, element: Any) -> bool: ...
|
||||
def issubset(self, other: BaseSet[_T]) -> bool: ...
|
||||
def issuperset(self, other: BaseSet[_T]) -> bool: ...
|
||||
def __le__(self, other: BaseSet[_T]) -> bool: ...
|
||||
def __ge__(self, other: BaseSet[_T]) -> bool: ...
|
||||
def __lt__(self, other: BaseSet[_T]) -> bool: ...
|
||||
def __gt__(self, other: BaseSet[_T]) -> bool: ...
|
||||
|
||||
class ImmutableSet(BaseSet[_T], Hashable):
|
||||
def __init__(self, iterable: Optional[_Setlike] = ...) -> None: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class Set(BaseSet[_T]):
|
||||
def __init__(self, iterable: Optional[_Setlike] = ...) -> None: ...
|
||||
def __ior__(self, other: BaseSet[_T]) -> Set: ...
|
||||
def union_update(self, other: _Setlike) -> None: ...
|
||||
def __iand__(self, other: BaseSet[_T]) -> Set: ...
|
||||
def intersection_update(self, other: _Setlike) -> None: ...
|
||||
def __ixor__(self, other: BaseSet[_T]) -> Set: ...
|
||||
def symmetric_difference_update(self, other: _Setlike) -> None: ...
|
||||
def __isub__(self, other: BaseSet[_T]) -> Set: ...
|
||||
def difference_update(self, other: _Setlike) -> None: ...
|
||||
def update(self, iterable: _Setlike) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def add(self, element: _T) -> None: ...
|
||||
def remove(self, element: _T) -> None: ...
|
||||
def discard(self, element: _T) -> None: ...
|
||||
def pop(self) -> _T: ...
|
||||
def __as_immutable__(self) -> ImmutableSet[_T]: ...
|
||||
def __as_temporarily_immutable__(self) -> _TemporarilyImmutableSet[_T]: ...
|
||||
|
||||
class _TemporarilyImmutableSet(BaseSet[_T]):
|
||||
def __init__(self, set: BaseSet[_T]) -> None: ...
|
||||
def __hash__(self) -> int: ...
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for shutil (Python 2)
|
||||
#
|
||||
# NOTE: Based on a dynamically typed stub automatically generated by stubgen.
|
||||
|
||||
from typing import List, Iterable, Callable, IO, AnyStr, Any, Optional, Tuple, Sequence
|
||||
|
||||
class Error(EnvironmentError): ...
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for smtplib (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class SMTPException(Exception): ...
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
from typing import List, NamedTuple
|
||||
|
||||
struct_spwd = NamedTuple("struct_spwd", [("sp_nam", str),
|
||||
("sp_pwd", str),
|
||||
("sp_lstchg", int),
|
||||
("sp_min", int),
|
||||
("sp_max", int),
|
||||
("sp_warn", int),
|
||||
("sp_inact", int),
|
||||
("sp_expire", int),
|
||||
("sp_flag", int)])
|
||||
|
||||
def getspall() -> List[struct_spwd]: ...
|
||||
def getspnam(name: str) -> struct_spwd: ...
|
||||
@@ -1,5 +1 @@
|
||||
# Stubs for sqlite3 (Python 3.5)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from sqlite3.dbapi2 import * # noqa: F403
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
# Filip Hron <filip.hron@gmail.com>
|
||||
# based heavily on Andrey Vlasovskikh's python-skeletons https://github.com/JetBrains/python-skeletons/blob/master/sqlite3.py
|
||||
|
||||
from typing import Any, Union, List, Iterator
|
||||
from numbers import Integral
|
||||
from typing import Any, Union, List, Iterator, Optional
|
||||
from datetime import time, datetime
|
||||
from collections import Iterable
|
||||
|
||||
@@ -141,7 +140,7 @@ class Cursor(Iterator[Any]):
|
||||
def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable]): ...
|
||||
def executescript(self, sql_script: Union[bytes, unicode]) -> Cursor: ...
|
||||
def fetchall(self) -> List[Any]: ...
|
||||
def fetchmany(self, size: Integral = ...) -> List[Any]: ...
|
||||
def fetchmany(self, size: Optional[int] = ...) -> List[Any]: ...
|
||||
def fetchone(self) -> Any: ...
|
||||
def setinputsizes(self, *args, **kwargs): ...
|
||||
def setoutputsize(self, *args, **kwargs): ...
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
# Source: https://hg.python.org/cpython/file/2.7/Lib/sre_constants.py
|
||||
|
||||
from typing import Dict, List, TypeVar
|
||||
|
||||
MAGIC = ... # type: int
|
||||
MAXREPEAT = ... # type: int
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
FAILURE = ... # type: str
|
||||
SUCCESS = ... # type: str
|
||||
ANY = ... # type: str
|
||||
ANY_ALL = ... # type: str
|
||||
ASSERT = ... # type: str
|
||||
ASSERT_NOT = ... # type: str
|
||||
AT = ... # type: str
|
||||
BIGCHARSET = ... # type: str
|
||||
BRANCH = ... # type: str
|
||||
CALL = ... # type: str
|
||||
CATEGORY = ... # type: str
|
||||
CHARSET = ... # type: str
|
||||
GROUPREF = ... # type: str
|
||||
GROUPREF_IGNORE = ... # type: str
|
||||
GROUPREF_EXISTS = ... # type: str
|
||||
IN = ... # type: str
|
||||
IN_IGNORE = ... # type: str
|
||||
INFO = ... # type: str
|
||||
JUMP = ... # type: str
|
||||
LITERAL = ... # type: str
|
||||
LITERAL_IGNORE = ... # type: str
|
||||
MARK = ... # type: str
|
||||
MAX_REPEAT = ... # type: str
|
||||
MAX_UNTIL = ... # type: str
|
||||
MIN_REPEAT = ... # type: str
|
||||
MIN_UNTIL = ... # type: str
|
||||
NEGATE = ... # type: str
|
||||
NOT_LITERAL = ... # type: str
|
||||
NOT_LITERAL_IGNORE = ... # type: str
|
||||
RANGE = ... # type: str
|
||||
REPEAT = ... # type: str
|
||||
REPEAT_ONE = ... # type: str
|
||||
SUBPATTERN = ... # type: str
|
||||
MIN_REPEAT_ONE = ... # type: str
|
||||
AT_BEGINNING = ... # type: str
|
||||
AT_BEGINNING_LINE = ... # type: str
|
||||
AT_BEGINNING_STRING = ... # type: str
|
||||
AT_BOUNDARY = ... # type: str
|
||||
AT_NON_BOUNDARY = ... # type: str
|
||||
AT_END = ... # type: str
|
||||
AT_END_LINE = ... # type: str
|
||||
AT_END_STRING = ... # type: str
|
||||
AT_LOC_BOUNDARY = ... # type: str
|
||||
AT_LOC_NON_BOUNDARY = ... # type: str
|
||||
AT_UNI_BOUNDARY = ... # type: str
|
||||
AT_UNI_NON_BOUNDARY = ... # type: str
|
||||
CATEGORY_DIGIT = ... # type: str
|
||||
CATEGORY_NOT_DIGIT = ... # type: str
|
||||
CATEGORY_SPACE = ... # type: str
|
||||
CATEGORY_NOT_SPACE = ... # type: str
|
||||
CATEGORY_WORD = ... # type: str
|
||||
CATEGORY_NOT_WORD = ... # type: str
|
||||
CATEGORY_LINEBREAK = ... # type: str
|
||||
CATEGORY_NOT_LINEBREAK = ... # type: str
|
||||
CATEGORY_LOC_WORD = ... # type: str
|
||||
CATEGORY_LOC_NOT_WORD = ... # type: str
|
||||
CATEGORY_UNI_DIGIT = ... # type: str
|
||||
CATEGORY_UNI_NOT_DIGIT = ... # type: str
|
||||
CATEGORY_UNI_SPACE = ... # type: str
|
||||
CATEGORY_UNI_NOT_SPACE = ... # type: str
|
||||
CATEGORY_UNI_WORD = ... # type: str
|
||||
CATEGORY_UNI_NOT_WORD = ... # type: str
|
||||
CATEGORY_UNI_LINEBREAK = ... # type: str
|
||||
CATEGORY_UNI_NOT_LINEBREAK = ... # type: str
|
||||
|
||||
_T = TypeVar('_T')
|
||||
def makedict(list: List[_T]) -> Dict[_T, int]: ...
|
||||
|
||||
OP_IGNORE = ... # type: Dict[str, str]
|
||||
AT_MULTILINE = ... # type: Dict[str, str]
|
||||
AT_LOCALE = ... # type: Dict[str, str]
|
||||
AT_UNICODE = ... # type: Dict[str, str]
|
||||
CH_LOCALE = ... # type: Dict[str, str]
|
||||
CH_UNICODE = ... # type: Dict[str, str]
|
||||
SRE_FLAG_TEMPLATE = ... # type: int
|
||||
SRE_FLAG_IGNORECASE = ... # type: int
|
||||
SRE_FLAG_LOCALE = ... # type: int
|
||||
SRE_FLAG_MULTILINE = ... # type: int
|
||||
SRE_FLAG_DOTALL = ... # type: int
|
||||
SRE_FLAG_UNICODE = ... # type: int
|
||||
SRE_FLAG_VERBOSE = ... # type: int
|
||||
SRE_FLAG_DEBUG = ... # type: int
|
||||
SRE_INFO_PREFIX = ... # type: int
|
||||
SRE_INFO_LITERAL = ... # type: int
|
||||
SRE_INFO_CHARSET = ... # type: int
|
||||
@@ -0,0 +1,63 @@
|
||||
# Source: https://hg.python.org/cpython/file/2.7/Lib/sre_parse.py
|
||||
|
||||
from typing import Any, Dict, Iterable, List, Match, Optional, Pattern as _Pattern, Set, Tuple, Union
|
||||
|
||||
SPECIAL_CHARS = ... # type: str
|
||||
REPEAT_CHARS = ... # type: str
|
||||
DIGITS = ... # type: Set
|
||||
OCTDIGITS = ... # type: Set
|
||||
HEXDIGITS = ... # type: Set
|
||||
WHITESPACE = ... # type: Set
|
||||
ESCAPES = ... # type: Dict[str, Tuple[str, int]]
|
||||
CATEGORIES = ... # type: Dict[str, Union[Tuple[str, str], Tuple[str, List[Tuple[str, str]]]]]
|
||||
FLAGS = ... # type: Dict[str, int]
|
||||
|
||||
class Pattern:
|
||||
flags = ... # type: int
|
||||
open = ... # type: List[int]
|
||||
groups = ... # type: int
|
||||
groupdict = ... # type: Dict[str, int]
|
||||
lookbehind = ... # type: int
|
||||
def __init__(self) -> None: ...
|
||||
def opengroup(self, name: str = ...) -> int: ...
|
||||
def closegroup(self, gid: int) -> None: ...
|
||||
def checkgroup(self, gid: int) -> bool: ...
|
||||
|
||||
|
||||
_OpSubpatternType = Tuple[Optional[int], int, int, SubPattern]
|
||||
_OpGroupRefExistsType = Tuple[int, SubPattern, SubPattern]
|
||||
_OpInType = List[Tuple[str, int]]
|
||||
_OpBranchType = Tuple[None, List[SubPattern]]
|
||||
_AvType = Union[_OpInType, _OpBranchType, Iterable[SubPattern], _OpGroupRefExistsType, _OpSubpatternType]
|
||||
_CodeType = Union[str, _AvType]
|
||||
|
||||
class SubPattern:
|
||||
pattern = ... # type: str
|
||||
data = ... # type: List[_CodeType]
|
||||
width = ... # type: Optional[int]
|
||||
def __init__(self, pattern, data: List[_CodeType] = ...) -> None: ...
|
||||
def dump(self, level: int = ...) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __delitem__(self, index: Union[int, slice]) -> None: ...
|
||||
def __getitem__(self, index: Union[int, slice]) -> Union[SubPattern, _CodeType]: ...
|
||||
def __setitem__(self, index: Union[int, slice], code: _CodeType): ...
|
||||
def insert(self, index, code: _CodeType) -> None: ...
|
||||
def append(self, code: _CodeType) -> None: ...
|
||||
def getwidth(self) -> int: ...
|
||||
|
||||
class Tokenizer:
|
||||
string = ... # type: str
|
||||
index = ... # type: int
|
||||
def __init__(self, string: str) -> None: ...
|
||||
def match(self, char: str, skip: int = ...) -> int: ...
|
||||
def get(self) -> Optional[str]: ...
|
||||
def tell(self) -> Tuple[int, Optional[str]]: ...
|
||||
def seek(self, index: int) -> None: ...
|
||||
|
||||
def isident(char: str) -> bool: ...
|
||||
def isdigit(char: str) -> bool: ...
|
||||
def isname(name: str) -> bool: ...
|
||||
def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ...
|
||||
_Template = Tuple[List[Tuple[int, int]], List[Optional[int]]]
|
||||
def parse_template(source: str, pattern: _Pattern) -> _Template: ...
|
||||
def expand_template(template: _Template, match: Match) -> str: ...
|
||||
@@ -41,9 +41,9 @@ def strip(s: AnyStr, chars: AnyStr = ...) -> AnyStr: ...
|
||||
def swapcase(s: AnyStr) -> AnyStr: ...
|
||||
def translate(s: str, table: str, deletechars: str = ...) -> str: ...
|
||||
def upper(s: AnyStr) -> AnyStr: ...
|
||||
def ljust(s: AnyStr, width: int, fillhar: AnyStr = ...) -> AnyStr: ...
|
||||
def rjust(s: AnyStr, width: int, fillhar: AnyStr = ...) -> AnyStr: ...
|
||||
def center(s: AnyStr, width: int, fillhar: AnyStr = ...) -> AnyStr: ...
|
||||
def ljust(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ...
|
||||
def rjust(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ...
|
||||
def center(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ...
|
||||
def zfill(s: AnyStr, width: int) -> AnyStr: ...
|
||||
def replace(s: AnyStr, old: AnyStr, new: AnyStr, maxreplace: int = ...) -> AnyStr: ...
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
# Source: https://hg.python.org/cpython/file/2.7/Lib/stringold.py
|
||||
from typing import AnyStr, Iterable, List, Optional, Type
|
||||
|
||||
whitespace = ... # type: str
|
||||
lowercase = ... # type: str
|
||||
uppercase = ... # type: str
|
||||
letters = ... # type: str
|
||||
digits = ... # type: str
|
||||
hexdigits = ... # type: str
|
||||
octdigits = ... # type: str
|
||||
_idmap = ... # type: str
|
||||
_idmapL = ... # type: Optional[List[str]]
|
||||
index_error = ValueError
|
||||
atoi_error = ValueError
|
||||
atof_error = ValueError
|
||||
atol_error = ValueError
|
||||
|
||||
|
||||
def lower(s: AnyStr) -> AnyStr: ...
|
||||
def upper(s: AnyStr) -> AnyStr: ...
|
||||
def swapcase(s: AnyStr) -> AnyStr: ...
|
||||
def strip(s: AnyStr) -> AnyStr: ...
|
||||
def lstrip(s: AnyStr) -> AnyStr: ...
|
||||
def rstrip(s: AnyStr) -> AnyStr: ...
|
||||
def split(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ...
|
||||
def splitfields(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ...
|
||||
def join(words: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ...
|
||||
def joinfields(words: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ...
|
||||
def index(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ...
|
||||
def rindex(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ...
|
||||
def count(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ...
|
||||
def find(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ...
|
||||
def rfind(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ...
|
||||
def atof(s: unicode) -> float: ...
|
||||
def atoi(s: unicode, base: int = ...) -> int: ...
|
||||
def atol(s: unicode, base: int = ...) -> long: ...
|
||||
def ljust(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ...
|
||||
def rjust(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ...
|
||||
def center(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ...
|
||||
def zfill(s: AnyStr, width: int) -> AnyStr: ...
|
||||
def expandtabs(s: AnyStr, tabsize: int = ...) -> AnyStr: ...
|
||||
def translate(s: str, table: str, deletions: str = ...) -> str: ...
|
||||
def capitalize(s: AnyStr) -> AnyStr: ...
|
||||
def capwords(s: AnyStr, sep: AnyStr = ...) -> AnyStr: ...
|
||||
def maketrans(fromstr: str, tostr: str) -> str: ...
|
||||
def replace(s: AnyStr, old: AnyStr, new: AnyStr, maxreplace: int = ...) -> AnyStr: ...
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
# Based on http://docs.python.org/2/library/subprocess.html and Python 3 stub
|
||||
|
||||
from typing import Sequence, Any, AnyStr, Mapping, Callable, Tuple, IO, Union, Optional, List, Text
|
||||
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Union, Optional, List, Text
|
||||
|
||||
_FILE = Union[int, IO[Any]]
|
||||
_FILE = Union[None, int, IO[Any]]
|
||||
_TXT = Union[bytes, Text]
|
||||
_CMD = Union[_TXT, Sequence[_TXT]]
|
||||
_ENV = Union[Mapping[bytes, _TXT], Mapping[Text, _TXT]]
|
||||
|
||||
@@ -88,4 +88,4 @@ testlist1 = ... # type: int
|
||||
encoding_decl = ... # type: int
|
||||
yield_expr = ... # type: int
|
||||
|
||||
symbol = ... # type: Dict[int, str]
|
||||
sym_name = ... # type: Dict[int, str]
|
||||
|
||||
@@ -61,7 +61,7 @@ long_info = ... # type: object
|
||||
maxint = ... # type: int
|
||||
maxsize = ... # type: int
|
||||
maxunicode = ... # type: int
|
||||
modules = ... # type: Dict[str, ModuleType]
|
||||
modules = ... # type: Dict[str, Any]
|
||||
path = ... # type: List[str]
|
||||
platform = ... # type: str
|
||||
prefix = ... # type: str
|
||||
@@ -124,7 +124,7 @@ def exit(arg: Any = ...) -> NoReturn:
|
||||
def getcheckinterval() -> int: ... # deprecated
|
||||
def getdefaultencoding() -> str: ...
|
||||
def getdlopenflags() -> int: ...
|
||||
def getfilesystemencoding() -> Union[str, None]: ...
|
||||
def getfilesystemencoding() -> str: ... # In practice, never returns None
|
||||
def getrefcount(arg: Any) -> int: ...
|
||||
def getrecursionlimit() -> int: ...
|
||||
def getsizeof(obj: object, default: int = ...) -> int: ...
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
# Stubs for textwrap (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, AnyStr
|
||||
|
||||
class _unicode: ...
|
||||
|
||||
@@ -30,4 +26,4 @@ class TextWrapper:
|
||||
|
||||
def wrap(text, width=..., **kwargs): ...
|
||||
def fill(text, width=..., **kwargs): ...
|
||||
def dedent(text): ...
|
||||
def dedent(text: AnyStr) -> AnyStr: ...
|
||||
|
||||
@@ -13,7 +13,7 @@ class LockType:
|
||||
def locked(self) -> bool: ...
|
||||
def locked_lock(self) -> bool: ...
|
||||
def __enter__(self) -> LockType: ...
|
||||
def __exit__(self, value: Any, traceback: Any) -> None: ...
|
||||
def __exit__(self, typ: Any, value: Any, traceback: Any) -> None: ...
|
||||
|
||||
class _local(object):
|
||||
pass
|
||||
|
||||
@@ -17,6 +17,9 @@ class struct_time(NamedTuple('_struct_time',
|
||||
def __init__(self, o: Tuple[int, int, int,
|
||||
int, int, int,
|
||||
int, int, int], _arg: Any = ...) -> None: ...
|
||||
def __new__(cls, o: Tuple[int, int, int,
|
||||
int, int, int,
|
||||
int, int, int], _arg: Any = ...) -> struct_time: ...
|
||||
|
||||
_TIME_TUPLE = Tuple[int, int, int, int, int, int, int, int, int]
|
||||
|
||||
@@ -32,7 +35,7 @@ def gmtime(secs: Optional[float] = ...) -> struct_time: ...
|
||||
|
||||
def localtime(secs: Optional[float] = ...) -> struct_time: ...
|
||||
|
||||
def mktime(t: struct_time) -> float:
|
||||
def mktime(t: Union[struct_time, _TIME_TUPLE]) -> float:
|
||||
raise OverflowError()
|
||||
raise ValueError()
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Stubs for toaiff (Python 2)
|
||||
|
||||
# Source: https://hg.python.org/cpython/file/2.7/Lib/toaiff.py
|
||||
from pipes import Template
|
||||
from typing import Dict, List
|
||||
|
||||
|
||||
__all__: List[str]
|
||||
table: Dict[str, Template]
|
||||
t: Template
|
||||
uncompress: Template
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
def toaiff(filename: str) -> str: ...
|
||||
def _toaiff(filename: str, temps: List[str]) -> str: ...
|
||||
@@ -102,15 +102,11 @@ chain = ... # type: type
|
||||
double3prog = ... # type: type
|
||||
endprogs = ... # type: Dict[str, Any]
|
||||
pseudoprog = ... # type: type
|
||||
re = ... # type: module
|
||||
single3prog = ... # type: type
|
||||
single_quoted = ... # type: Dict[str, str]
|
||||
string = ... # type: module
|
||||
sys = ... # type: module
|
||||
t = ... # type: str
|
||||
tabsize = ... # type: int
|
||||
tok_name = ... # type: Dict[int, str]
|
||||
token = ... # type: module
|
||||
tokenprog = ... # type: type
|
||||
triple_quoted = ... # type: Dict[str, str]
|
||||
x = ... # type: str
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
from typing import (
|
||||
Any, Callable, Dict, Iterable, Iterator, List, Optional,
|
||||
Tuple, TypeVar, Union, overload,
|
||||
Tuple, Type, TypeVar, Union, overload,
|
||||
)
|
||||
|
||||
_T = TypeVar('_T')
|
||||
@@ -19,11 +19,12 @@ BooleanType = bool
|
||||
ComplexType = complex
|
||||
StringType = str
|
||||
UnicodeType = unicode
|
||||
StringTypes = (StringType, UnicodeType)
|
||||
StringTypes = ... # type: Tuple[Type[StringType], Type[UnicodeType]]
|
||||
BufferType = buffer
|
||||
TupleType = tuple
|
||||
ListType = list
|
||||
DictType = DictionaryType = dict
|
||||
DictType = dict
|
||||
DictionaryType = dict
|
||||
|
||||
class _Cell:
|
||||
cell_contents = ... # type: Any
|
||||
@@ -81,6 +82,7 @@ class UnboundMethodType:
|
||||
im_class = ... # type: type
|
||||
im_func = ... # type: FunctionType
|
||||
im_self = ... # type: object
|
||||
__name__ = ... # type: str
|
||||
__func__ = im_func
|
||||
__self__ = im_self
|
||||
def __init__(self, func: Callable, obj: object) -> None: ...
|
||||
@@ -104,6 +106,7 @@ class ModuleType:
|
||||
__name__ = ... # type: str
|
||||
__package__ = ... # type: Optional[str]
|
||||
__path__ = ... # type: Optional[Iterable[str]]
|
||||
__dict__ = ... # type: Dict[str, Any]
|
||||
def __init__(self, name: str, doc: Optional[str] = ...) -> None: ...
|
||||
FileType = file
|
||||
XRangeType = xrange
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# Stubs for typing (Python 2.7)
|
||||
|
||||
from abc import abstractmethod, ABCMeta
|
||||
from types import CodeType, FrameType
|
||||
from types import CodeType, FrameType, TracebackType
|
||||
import collections # Needed by aliases like DefaultDict, see mypy issue 2986
|
||||
|
||||
# Definitions of special type checking related constructs. Their definitions
|
||||
# are not used, so their value does not matter.
|
||||
@@ -9,16 +10,25 @@ from types import CodeType, FrameType
|
||||
overload = object()
|
||||
Any = object()
|
||||
TypeVar = object()
|
||||
Generic = object()
|
||||
Tuple = object()
|
||||
Callable = object()
|
||||
Type = object()
|
||||
_promote = object()
|
||||
no_type_check = object()
|
||||
ClassVar = object()
|
||||
|
||||
class _SpecialForm(object):
|
||||
def __getitem__(self, typeargs: Any) -> object: ...
|
||||
|
||||
Tuple: _SpecialForm = ...
|
||||
Generic: _SpecialForm = ...
|
||||
Callable: _SpecialForm = ...
|
||||
Type: _SpecialForm = ...
|
||||
ClassVar: _SpecialForm = ...
|
||||
|
||||
class GenericMeta(type): ...
|
||||
|
||||
# Return type that indicates a function does not return.
|
||||
# This type is equivalent to the None type, but the no-op Union is necessary to
|
||||
# distinguish the None type from the None value.
|
||||
NoReturn = Union[None]
|
||||
|
||||
# Type aliases and type constructors
|
||||
|
||||
class TypeAlias:
|
||||
@@ -199,6 +209,12 @@ class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]):
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_VT_co]: ...
|
||||
|
||||
class ContextManager(Generic[_T_co]):
|
||||
def __enter__(self) -> _T_co: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]],
|
||||
exc_value: Optional[BaseException],
|
||||
traceback: Optional[TracebackType]) -> Optional[bool]: ...
|
||||
|
||||
class Mapping(Iterable[_KT], Container[_KT], Sized, 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.
|
||||
@@ -206,9 +222,9 @@ class Mapping(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT_co]):
|
||||
def __getitem__(self, k: _KT) -> _VT_co:
|
||||
...
|
||||
# Mixin methods
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def get(self, k: _KT) -> Optional[_VT_co]: ...
|
||||
@overload # type: ignore
|
||||
@overload
|
||||
def get(self, k: _KT, default: Union[_VT_co, _T]) -> Union[_VT_co, _T]: ...
|
||||
def keys(self) -> list[_KT]: ...
|
||||
def values(self) -> list[_VT_co]: ...
|
||||
@@ -381,7 +397,8 @@ class Pattern(Generic[AnyStr]):
|
||||
|
||||
# Functions
|
||||
|
||||
def get_type_hints(obj: Callable) -> dict[str, Any]: ...
|
||||
def get_type_hints(obj: Callable, globalns: Optional[dict[Text, Any]] = ...,
|
||||
localns: Optional[dict[Text, Any]] = ...) -> None: ...
|
||||
|
||||
def cast(tp: Type[_T], obj: Any) -> _T: ...
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
# Only a subset of functionality is included.
|
||||
|
||||
from typing import (
|
||||
Any, Callable, Dict, Iterable, Tuple, List, TextIO, Sequence,
|
||||
overload, Set, FrozenSet, TypeVar, Union, Pattern, Type
|
||||
)
|
||||
from typing import (Any, Callable, Dict, FrozenSet, Iterable, List, Optional,
|
||||
overload, Pattern, Sequence, Set, TextIO, Tuple, Type,
|
||||
TypeVar, Union)
|
||||
from abc import abstractmethod, ABCMeta
|
||||
import types
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_FT = TypeVar('_FT')
|
||||
@@ -152,11 +152,26 @@ class TestSuite(Testable):
|
||||
def debug(self) -> None: ...
|
||||
def countTestCases(self) -> int: ...
|
||||
|
||||
# TODO TestLoader
|
||||
# TODO defaultTestLoader
|
||||
class TestLoader:
|
||||
testMethodPrefix = ... # type: str
|
||||
sortTestMethodsUsing = ... # type: Optional[Callable[[str, str], int]]
|
||||
suiteClass = ... # type: Callable[[List[TestCase]], TestSuite]
|
||||
def loadTestsFromTestCase(self,
|
||||
testCaseClass: Type[TestCase]) -> TestSuite: ...
|
||||
def loadTestsFromModule(self, module: str = ...,
|
||||
use_load_tests: bool = ...) -> TestSuite: ...
|
||||
def loadTestsFromName(self, name: str = ...,
|
||||
module: Optional[str] = ...) -> TestSuite: ...
|
||||
def loadTestsFromNames(self, names: List[str] = ...,
|
||||
module: Optional[str] = ...) -> TestSuite: ...
|
||||
def discover(self, start_dir: str, pattern: str = ...,
|
||||
top_level_dir: Optional[str] = ...) -> TestSuite: ...
|
||||
def getTestCaseNames(self, testCaseClass: Type[TestCase] = ...) -> List[str]: ...
|
||||
|
||||
defaultTestLoader = TestLoader
|
||||
|
||||
class TextTestRunner:
|
||||
def __init__(self, stream: TextIO = ..., descriptions: bool = ...,
|
||||
def __init__(self, stream: Optional[TextIO] = ..., descriptions: bool = ...,
|
||||
verbosity: int = ..., failfast: bool = ...) -> None: ...
|
||||
|
||||
class SkipTest(Exception):
|
||||
@@ -168,9 +183,16 @@ def skipIf(condition: Any, reason: Union[str, unicode]) -> Any: ...
|
||||
def expectedFailure(func: _FT) -> _FT: ...
|
||||
def skip(reason: Union[str, unicode]) -> Any: ...
|
||||
|
||||
def main(module: str = ..., defaultTest: str = ...,
|
||||
argv: List[str] = ..., testRunner: Any = ...,
|
||||
testLoader: Any = ...) -> None: ... # TODO types
|
||||
# not really documented
|
||||
class TestProgram:
|
||||
result = ... # type: TestResult
|
||||
|
||||
def main(module: str = ..., defaultTest: Optional[str] = ...,
|
||||
argv: Optional[Sequence[str]] = ...,
|
||||
testRunner: Union[Type[TextTestRunner], TextTestRunner, None] = ...,
|
||||
testLoader: TestLoader = ..., exit: bool = ..., verbosity: int = ...,
|
||||
failfast: Optional[bool] = ..., catchbreak: Optional[bool] = ...,
|
||||
buffer: Optional[bool] = ...) -> TestProgram: ...
|
||||
|
||||
# private but occasionally used
|
||||
util = ... # type: module
|
||||
util = ... # type: types.ModuleType
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# Stubs for urllib (Python 2)
|
||||
# NOTE: This dynamically typed stub was originally automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Mapping, Union, Tuple, Sequence, IO
|
||||
|
||||
def url2pathname(pathname: str) -> str: ...
|
||||
|
||||
@@ -41,7 +41,7 @@ class Request(object):
|
||||
def add_header(self, key: str, val: str) -> None: ...
|
||||
def add_unredirected_header(self, key: str, val: str) -> None: ...
|
||||
def has_header(self, header_name: str) -> bool: ...
|
||||
def get_header(self, header_name: str, default: str = None) -> str: ...
|
||||
def get_header(self, header_name: str, default: Optional[str] = None) -> str: ...
|
||||
def header_items(self): ...
|
||||
|
||||
class OpenerDirector(object):
|
||||
@@ -128,7 +128,7 @@ class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
|
||||
def http_error_407(self, req, fp, code, msg, headers): ...
|
||||
|
||||
class AbstractHTTPHandler(BaseHandler):
|
||||
def __init__(self, debuglevel: int) -> None: ...
|
||||
def __init__(self, debuglevel: int=0) -> None: ...
|
||||
def do_request_(self, request): ...
|
||||
def do_open(self, http_class, req): ...
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Stubs for urlparse (Python 2)
|
||||
|
||||
from typing import Dict, List, NamedTuple, Tuple, Sequence, Union, overload
|
||||
from typing import AnyStr, Dict, List, NamedTuple, Tuple, Sequence, Union, overload
|
||||
|
||||
_String = Union[str, unicode]
|
||||
|
||||
uses_relative = ... # type: List[str]
|
||||
uses_netloc = ... # type: List[str]
|
||||
@@ -46,23 +48,23 @@ class ParseResult(
|
||||
):
|
||||
def geturl(self) -> str: ...
|
||||
|
||||
def urlparse(url: Union[str, unicode], scheme: str = ...,
|
||||
def urlparse(url: _String, scheme: _String = ...,
|
||||
allow_fragments: bool = ...) -> ParseResult: ...
|
||||
def urlsplit(url: Union[str, unicode], scheme: str = ...,
|
||||
def urlsplit(url: _String, scheme: _String = ...,
|
||||
allow_fragments: bool = ...) -> SplitResult: ...
|
||||
@overload
|
||||
def urlunparse(data: Tuple[str, str, str, str, str, str]) -> str: ...
|
||||
def urlunparse(data: Tuple[_String, _String, _String, _String, _String, _String]) -> str: ...
|
||||
@overload
|
||||
def urlunparse(data: Sequence[str]) -> str: ...
|
||||
def urlunparse(data: Sequence[_String]) -> str: ...
|
||||
@overload
|
||||
def urlunsplit(data: Tuple[str, str, str, str, str]) -> str: ...
|
||||
def urlunsplit(data: Tuple[_String, _String, _String, _String, _String]) -> str: ...
|
||||
@overload
|
||||
def urlunsplit(data: Sequence[str]) -> str: ...
|
||||
def urljoin(base: Union[str, unicode], url: Union[str, unicode],
|
||||
def urlunsplit(data: Sequence[_String]) -> str: ...
|
||||
def urljoin(base: _String, url: _String,
|
||||
allow_fragments: bool = ...) -> str: ...
|
||||
def urldefrag(url: Union[str, unicode]) -> str: ...
|
||||
def unquote(s: str) -> str: ...
|
||||
def parse_qs(qs: str, keep_blank_values: bool = ...,
|
||||
strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
|
||||
def parse_qsl(qs: str, keep_blank_values: int = ...,
|
||||
strict_parsing: bool = ...) -> List[Tuple[str, str]]: ...
|
||||
def urldefrag(url: AnyStr) -> Tuple[AnyStr, str]: ...
|
||||
def unquote(s: AnyStr) -> AnyStr: ...
|
||||
def parse_qs(qs: AnyStr, keep_blank_values: bool = ...,
|
||||
strict_parsing: bool = ...) -> Dict[AnyStr, List[AnyStr]]: ...
|
||||
def parse_qsl(qs: AnyStr, keep_blank_values: int = ...,
|
||||
strict_parsing: bool = ...) -> List[Tuple[AnyStr, AnyStr]]: ...
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# Stubs for user (Python 2)
|
||||
|
||||
# Docs: https://docs.python.org/2/library/user.html
|
||||
# Source: https://hg.python.org/cpython/file/2.7/Lib/user.py
|
||||
from typing import Any
|
||||
|
||||
def __getattr__(name) -> Any: ... # type: ignore
|
||||
home: str
|
||||
pythonrc: str
|
||||
@@ -1,7 +1,3 @@
|
||||
# Stubs for wsgiref.validate (Python 2)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
class WSGIWarning(Warning): ...
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
# Stubs for xmlrpclib (Python 2)
|
||||
|
||||
from typing import Any, AnyStr, Callable, IO, Iterable, List, Mapping, MutableMapping, Optional, Tuple, Type, TypeVar, Union
|
||||
from types import InstanceType
|
||||
from datetime import datetime
|
||||
from time import struct_time
|
||||
from httplib import HTTPConnection, HTTPResponse, HTTPSConnection
|
||||
from ssl import SSLContext
|
||||
from StringIO import StringIO
|
||||
from gzip import GzipFile
|
||||
|
||||
_Unmarshaller = Any
|
||||
_timeTuple = Tuple[int, int, int, int, int, int, int, int, int]
|
||||
# Represents types that can be compared against a DateTime object
|
||||
_dateTimeComp = Union[AnyStr, DateTime, datetime, _timeTuple]
|
||||
# A "host description" used by Transport factories
|
||||
_hostDesc = Union[str, Tuple[str, Mapping[Any, Any]]]
|
||||
|
||||
def escape(s: AnyStr, replace: Callable[[AnyStr, AnyStr, AnyStr], AnyStr] = ...) -> AnyStr: ...
|
||||
|
||||
MAXINT = ... # type: int
|
||||
MININT = ... # type: int
|
||||
PARSE_ERROR = ... # type: int
|
||||
SERVER_ERROR = ... # type: int
|
||||
APPLICATION_ERROR = ... # type: int
|
||||
SYSTEM_ERROR = ... # type: int
|
||||
TRANSPORT_ERROR = ... # type: int
|
||||
NOT_WELLFORMED_ERROR = ... # type: int
|
||||
UNSUPPORTED_ENCODING = ... # type: int
|
||||
INVALID_ENCODING_CHAR = ... # type: int
|
||||
INVALID_XMLRPC = ... # type: int
|
||||
METHOD_NOT_FOUND = ... # type: int
|
||||
INVALID_METHOD_PARAMS = ... # type: int
|
||||
INTERNAL_ERROR = ... # type: int
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
class ProtocolError(Error):
|
||||
url = ... # type: str
|
||||
errcode = ... # type: int
|
||||
errmsg = ... # type: str
|
||||
headers = ... # type: Any
|
||||
def __init__(self, url: str, errcode: int, errmsg: str, headers: Any) -> None: ...
|
||||
|
||||
class ResponseError(Error): ...
|
||||
|
||||
class Fault(Error):
|
||||
faultCode = ... # type: Any
|
||||
faultString = ... # type: str
|
||||
def __init__(self, faultCode: Any, faultString: str, **extra: Any) -> None: ...
|
||||
|
||||
boolean = ... # type: Type[bool]
|
||||
Boolean = ... # type: Type[bool]
|
||||
|
||||
class DateTime:
|
||||
value = ... # type: str
|
||||
def __init__(self, value: Union[str, unicode, datetime, float, int, _timeTuple, struct_time] = ...) -> None: ...
|
||||
def make_comparable(self, other: _dateTimeComp) -> Tuple[_dateTimeComp, _dateTimeComp]: ...
|
||||
def __lt__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __le__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __gt__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __ge__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __eq__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __ne__(self, other: _dateTimeComp) -> bool: ...
|
||||
def timetuple(self) -> struct_time: ...
|
||||
def __cmp__(self, other: _dateTimeComp) -> int: ...
|
||||
def decode(self, data: Any) -> None: ...
|
||||
def encode(self, out: IO) -> None: ...
|
||||
|
||||
class Binary:
|
||||
data = ... # type: str
|
||||
def __init__(self, data: Optional[str] = ...) -> None: ...
|
||||
def __cmp__(self, other: Any) -> int: ...
|
||||
def decode(self, data: str) -> None: ...
|
||||
def encode(self, out: IO) -> None: ...
|
||||
|
||||
WRAPPERS = ... # type: tuple
|
||||
|
||||
# Still part of the public API, but see http://bugs.python.org/issue1773632
|
||||
FastParser = ... # type: None
|
||||
FastUnmarshaller = ... # type: None
|
||||
FastMarshaller = ... # type: None
|
||||
|
||||
# xmlrpclib.py will leave ExpatParser undefined if it can't import expat from
|
||||
# xml.parsers. Because this is Python 2.7, the import will succeed.
|
||||
class ExpatParser:
|
||||
def __init__(self, target: _Unmarshaller) -> None: ...
|
||||
def feed(self, data: str): ...
|
||||
def close(self): ...
|
||||
|
||||
# TODO: Add xmllib.XMLParser as base class
|
||||
class SlowParser:
|
||||
handle_xml = ... # type: Callable[[str, bool], None]
|
||||
unknown_starttag = ... # type: Callable[[str, Any], None]
|
||||
handle_data = ... # type: Callable[[str], None]
|
||||
handle_cdata = ... # type: Callable[[str], None]
|
||||
unknown_endtag = ... # type: Callable[[str, Callable[[Iterable[str], str], str]], None]
|
||||
def __init__(self, target: _Unmarshaller) -> None: ...
|
||||
|
||||
class Marshaller:
|
||||
memo = ... # type: MutableMapping[int, Any]
|
||||
data = ... # type: Optional[str]
|
||||
encoding = ... # type: Optional[str]
|
||||
allow_none = ... # type: bool
|
||||
def __init__(self, encoding: Optional[str] = ..., allow_none: bool = ...) -> None: ...
|
||||
dispatch = ... # type: Mapping[type, Callable[[Marshaller, str, Callable[[str], None]], None]]
|
||||
def dumps(self, values: Union[Iterable[Union[None, int, bool, long, float, str, unicode, List, Tuple, Mapping, datetime, InstanceType]], Fault]) -> str: ...
|
||||
def dump_nil(self, value: None, write: Callable[[str], None]) -> None: ...
|
||||
def dump_int(self, value: int, write: Callable[[str], None]) -> None: ...
|
||||
def dump_bool(self, value: bool, write: Callable[[str], None]) -> None: ...
|
||||
def dump_long(self, value: long, write: Callable[[str], None]) -> None: ...
|
||||
def dump_double(self, value: float, write: Callable[[str], None]) -> None: ...
|
||||
def dump_string(self, value: str, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
|
||||
def dump_unicode(self, value: unicode, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
|
||||
def dump_array(self, value: Union[List, Tuple], write: Callable[[str], None]) -> None: ...
|
||||
def dump_struct(self, value: Mapping, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
|
||||
def dump_datetime(self, value: datetime, write: Callable[[str], None]) -> None: ...
|
||||
def dump_instance(self, value: InstanceType, write: Callable[[str], None]) -> None: ...
|
||||
|
||||
class Unmarshaller:
|
||||
def append(self, object: Any) -> None: ...
|
||||
def __init__(self, use_datetime: bool = ...) -> None: ...
|
||||
def close(self) -> tuple: ...
|
||||
def getmethodname(self) -> Optional[str]: ...
|
||||
def xml(self, encoding: str, standalone: bool) -> None: ...
|
||||
def start(self, tag: str, attrs: Any) -> None: ...
|
||||
def data(self, text: str) -> None: ...
|
||||
def end(self, tag: str, join: Callable[[Iterable[str], str], str] = ...) -> None: ...
|
||||
def end_dispatch(self, tag: str, data: str) -> None: ...
|
||||
dispatch = ... # type: Mapping[str, Callable[[Unmarshaller, str], None]]
|
||||
def end_nil(self, data: str): ...
|
||||
def end_boolean(self, data: str) -> None: ...
|
||||
def end_int(self, data: str) -> None: ...
|
||||
def end_double(self, data: str) -> None: ...
|
||||
def end_string(self, data: str) -> None: ...
|
||||
def end_array(self, data: str) -> None: ...
|
||||
def end_struct(self, data: str) -> None: ...
|
||||
def end_base64(self, data: str) -> None: ...
|
||||
def end_dateTime(self, data: str) -> None: ...
|
||||
def end_value(self, data: str) -> None: ...
|
||||
def end_params(self, data: str) -> None: ...
|
||||
def end_fault(self, data: str) -> None: ...
|
||||
def end_methodName(self, data: str) -> None: ...
|
||||
|
||||
class _MultiCallMethod:
|
||||
def __init__(self, call_list: List[Tuple[str, tuple]], name: str) -> None: ...
|
||||
class MultiCallIterator:
|
||||
def __init__(self, results: List) -> None: ...
|
||||
|
||||
class MultiCall:
|
||||
def __init__(self, server: ServerProxy) -> None: ...
|
||||
def __getattr__(self, name: str) -> _MultiCallMethod: ...
|
||||
def __call__(self) -> MultiCallIterator: ...
|
||||
|
||||
def getparser(use_datetime: bool = ...) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ...
|
||||
def dumps(params: Union[tuple, Fault], methodname: Optional[str] = ..., methodresponse: Optional[bool] = ..., encoding: Optional[str] = ..., allow_none: bool = ...) -> str: ...
|
||||
def loads(data: str, use_datetime: bool = ...) -> Tuple[tuple, Optional[str]]: ...
|
||||
|
||||
def gzip_encode(data: str) -> str: ...
|
||||
def gzip_decode(data: str, max_decode: int = ...) -> str: ...
|
||||
|
||||
class GzipDecodedResponse(GzipFile):
|
||||
stringio = ... # type: StringIO
|
||||
def __init__(self, response: HTTPResponse) -> None: ...
|
||||
def close(self): ...
|
||||
|
||||
class _Method:
|
||||
def __init__(self, send: Callable[[str, tuple], Any], name: str) -> None: ...
|
||||
def __getattr__(self, name: str) -> _Method: ...
|
||||
def __call__(self, *args: Any) -> Any: ...
|
||||
|
||||
class Transport:
|
||||
user_agent = ... # type: str
|
||||
accept_gzip_encoding = ... # type: bool
|
||||
encode_threshold = ... # type: Optional[int]
|
||||
def __init__(self, use_datetime: bool = ...) -> None: ...
|
||||
def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
|
||||
verbose = ... # type: bool
|
||||
def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
|
||||
def getparser(self) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ...
|
||||
def get_host_info(self, host: _hostDesc) -> Tuple[str, Optional[List[Tuple[str, str]]], Optional[Mapping[Any, Any]]]: ...
|
||||
def make_connection(self, host: _hostDesc) -> HTTPConnection: ...
|
||||
def close(self) -> None: ...
|
||||
def send_request(self, connection: HTTPConnection, handler: str, request_body: str) -> None: ...
|
||||
def send_host(self, connection: HTTPConnection, host: str) -> None: ...
|
||||
def send_user_agent(self, connection: HTTPConnection) -> None: ...
|
||||
def send_content(self, connection: HTTPConnection, request_body: str) -> None: ...
|
||||
def parse_response(self, response: HTTPResponse) -> tuple: ...
|
||||
|
||||
class SafeTransport(Transport):
|
||||
def __init__(self, use_datetime: bool = ..., context: Optional[SSLContext] = ...) -> None: ...
|
||||
def make_connection(self, host: _hostDesc) -> HTTPSConnection: ...
|
||||
|
||||
class ServerProxy:
|
||||
def __init__(self, uri: str, transport: Optional[Transport] = ..., encoding: Optional[str] = ..., verbose: bool = ..., allow_none: bool = ..., use_datetime: bool = ..., context: Optional[SSLContext] = ...) -> None: ...
|
||||
def __getattr__(self, name: str) -> _Method: ...
|
||||
def __call__(self, attr: str) -> Optional[Transport]: ...
|
||||
|
||||
Server = ServerProxy
|
||||
@@ -0,0 +1,21 @@
|
||||
import sys
|
||||
from typing import List
|
||||
|
||||
class _Feature:
|
||||
def getOptionalRelease(self) -> sys._version_info: ...
|
||||
def getMandatoryRelease(self) -> sys._version_info: ...
|
||||
|
||||
absolute_import: _Feature
|
||||
division: _Feature
|
||||
generators: _Feature
|
||||
nested_scopes: _Feature
|
||||
print_function: _Feature
|
||||
unicode_literals: _Feature
|
||||
with_statement: _Feature
|
||||
if sys.version_info >= (3, 0):
|
||||
barry_as_FLUFL: _Feature
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
generator_stop: _Feature
|
||||
|
||||
all_feature_names: List[str]
|
||||
@@ -0,0 +1,74 @@
|
||||
"""Stub file for the '_codecs' module."""
|
||||
|
||||
import sys
|
||||
from typing import Any, Callable, Tuple, Optional, Dict, Text, Union
|
||||
|
||||
import codecs
|
||||
|
||||
# For convenience:
|
||||
_Handler = Callable[[Exception], Tuple[Text, int]]
|
||||
_String = Union[bytes, str]
|
||||
_Errors = Union[str, Text, None]
|
||||
if sys.version_info < (3, 0):
|
||||
_Decodable = Union[bytes, Text]
|
||||
_Encodable = Union[bytes, Text]
|
||||
else:
|
||||
_Decodable = bytes
|
||||
_Encodable = str
|
||||
|
||||
# This type is not exposed; it is defined in unicodeobject.c
|
||||
class _EncodingMap(object):
|
||||
def size(self) -> int: ...
|
||||
_MapT = Union[Dict[int, int], _EncodingMap]
|
||||
|
||||
def register(search_function: Callable[[str], Any]) -> None: ...
|
||||
def register_error(errors: Union[str, Text], handler: _Handler) -> None: ...
|
||||
def lookup(encoding: Union[str, Text]) -> codecs.CodecInfo: ...
|
||||
def lookup_error(name: Union[str, Text]) -> _Handler: ...
|
||||
def decode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ...
|
||||
def encode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ...
|
||||
def charmap_build(map: Text) -> _MapT: ...
|
||||
|
||||
def ascii_decode(data: _Decodable, errors: _Errors = ...) -> Tuple[Text, int]: ...
|
||||
def ascii_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def charbuffer_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def charmap_decode(data: _Decodable, errors: _Errors = ..., mapping: Optional[_MapT] = ...) -> Tuple[Text, int]: ...
|
||||
def charmap_encode(data: _Encodable, errors: _Errors, mapping: Optional[_MapT] = ...) -> Tuple[bytes, int]: ...
|
||||
def escape_decode(data: _String, errors: _Errors = ...) -> Tuple[str, int]: ...
|
||||
def escape_encode(data: bytes, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def latin_1_decode(data: _Decodable, errors: _Errors = ...) -> Tuple[Text, int]: ...
|
||||
def latin_1_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def raw_unicode_escape_decode(data: _String, errors: _Errors = ...) -> Tuple[Text, int]: ...
|
||||
def raw_unicode_escape_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def readbuffer_encode(data: _String, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def unicode_escape_decode(data: _String, errors: _Errors = ...) -> Tuple[Text, int]: ...
|
||||
def unicode_escape_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def unicode_internal_decode(data: _String, errors: _Errors = ...) -> Tuple[Text, int]: ...
|
||||
def unicode_internal_encode(data: _String, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_16_be_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_16_be_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_16_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_16_encode(data: _Encodable, errors: _Errors = ..., byteorder: int = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_16_ex_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int, int]: ...
|
||||
def utf_16_le_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_16_le_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_32_be_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_32_be_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_32_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_32_encode(data: _Encodable, errors: _Errors = ..., byteorder: int = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_32_ex_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int, int]: ...
|
||||
def utf_32_le_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_32_le_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_7_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_7_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def utf_8_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
|
||||
def utf_8_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
|
||||
if sys.platform == 'win32':
|
||||
def mbcs_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
|
||||
def mbcs_encode(str: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
if sys.version_info >= (3, 0):
|
||||
def oem_decode(data: bytes, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
|
||||
def code_page_decode(codepage: int, data: bytes, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
|
||||
def oem_encode(str: Text, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
def code_page_encode(code_page: int, str: Text, errors: _Errors = ...) -> Tuple[bytes, int]: ...
|
||||
@@ -0,0 +1,45 @@
|
||||
import sys
|
||||
|
||||
from typing import Any, Iterable, Iterator, List, Optional, Sequence
|
||||
|
||||
QUOTE_ALL = ... # type: int
|
||||
QUOTE_MINIMAL = ... # type: int
|
||||
QUOTE_NONE = ... # type: int
|
||||
QUOTE_NONNUMERIC = ... # type: int
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
class Dialect:
|
||||
delimiter = ... # type: str
|
||||
quotechar = ... # type: Optional[str]
|
||||
escapechar = ... # type: Optional[str]
|
||||
doublequote = ... # type: bool
|
||||
skipinitialspace = ... # type: bool
|
||||
lineterminator = ... # type: str
|
||||
quoting = ... # type: int
|
||||
strict = ... # type: int
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class _reader(Iterator[List[str]]):
|
||||
dialect = ... # type: Dialect
|
||||
line_num = ... # type: int
|
||||
|
||||
class _writer:
|
||||
dialect = ... # type: Dialect
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
def writerow(self, row: Iterable[Any]) -> None: ...
|
||||
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
|
||||
else:
|
||||
def writerow(self, row: Sequence[Any]) -> None: ...
|
||||
def writerows(self, rows: Iterable[Sequence[Any]]) -> None: ...
|
||||
|
||||
|
||||
# TODO: precise type
|
||||
def writer(csvfile: Any, dialect: Any = ..., **fmtparams: Any) -> _writer: ...
|
||||
def reader(csvfile: Iterable[str], dialect: Any = ..., **fmtparams: Any) -> _reader: ...
|
||||
def register_dialect(name: str, dialect: Any = ..., **fmtparams: Any) -> None: ...
|
||||
def unregister_dialect(name: str) -> None: ...
|
||||
def get_dialect(name: str) -> Dialect: ...
|
||||
def list_dialects() -> List[str]: ...
|
||||
def field_size_limit(new_limit: int = ...) -> int: ...
|
||||
@@ -0,0 +1,17 @@
|
||||
# Stubs for _random
|
||||
|
||||
import sys
|
||||
from typing import Tuple
|
||||
|
||||
# Actually Tuple[(int,) * 625]
|
||||
_State = Tuple[int, ...]
|
||||
|
||||
class Random(object):
|
||||
def __init__(self, seed: object = ...) -> None: ...
|
||||
def seed(self, x: object = ...) -> None: ...
|
||||
def getstate(self) -> _State: ...
|
||||
def setstate(self, state: _State) -> None: ...
|
||||
def random(self) -> float: ...
|
||||
def getrandbits(self, k: int) -> int: ...
|
||||
if sys.version_info < (3,):
|
||||
def jumpahead(self, i: int) -> None: ...
|
||||
@@ -0,0 +1,24 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Generic, Optional, TypeVar
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class CallableProxyType(object): # "weakcallableproxy"
|
||||
def __getattr__(self, attr: str) -> Any: ...
|
||||
|
||||
class ProxyType(object): # "weakproxy"
|
||||
def __getattr__(self, attr: str) -> Any: ...
|
||||
|
||||
class ReferenceType(Generic[_T]):
|
||||
if sys.version_info >= (3, 4):
|
||||
__callback__: Callable[[ReferenceType[_T]], Any]
|
||||
def __init__(self, o: _T, callback: Callable[[ReferenceType[_T]],
|
||||
Any] = ...) -> None: ...
|
||||
def __call__(self) -> Optional[_T]: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
ref = ReferenceType
|
||||
|
||||
def getweakrefcount(object: Any) -> int: ...
|
||||
def getweakrefs(object: Any) -> int: ...
|
||||
def proxy(object: _T, callback: Callable[[_T], Any] = ...) -> ref[_T]: ...
|
||||
@@ -0,0 +1,43 @@
|
||||
from typing import Iterator, Any, Iterable, MutableSet, Optional, TypeVar, Generic, Union
|
||||
|
||||
_S = TypeVar('_S')
|
||||
_T = TypeVar('_T')
|
||||
_SelfT = TypeVar('_SelfT', bound=WeakSet)
|
||||
|
||||
class WeakSet(MutableSet[_T], Generic[_T]):
|
||||
def __init__(self, data: Optional[Iterable[_T]] = ...) -> None: ...
|
||||
|
||||
def add(self, item: _T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def discard(self, item: _T) -> None: ...
|
||||
def copy(self: _SelfT) -> _SelfT: ...
|
||||
def pop(self) -> _T: ...
|
||||
def remove(self, item: _T) -> None: ...
|
||||
def update(self, other: Iterable[_T]) -> None: ...
|
||||
def __contains__(self, item: object) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
|
||||
def __ior__(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
|
||||
def difference(self: _SelfT, other: Iterable[_T]) -> _SelfT: ...
|
||||
def __sub__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ...
|
||||
def difference_update(self: _SelfT, other: Iterable[_T]) -> None: ...
|
||||
def __isub__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ...
|
||||
def intersection(self: _SelfT, other: Iterable[_T]) -> _SelfT: ...
|
||||
def __and__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ...
|
||||
def intersection_update(self, other: Iterable[_T]) -> None: ...
|
||||
def __iand__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ...
|
||||
def issubset(self, other: Iterable[_T]) -> bool: ...
|
||||
def __le__(self, other: Iterable[_T]) -> bool: ...
|
||||
def __lt__(self, other: Iterable[_T]) -> bool: ...
|
||||
def issuperset(self, other: Iterable[_T]) -> bool: ...
|
||||
def __ge__(self, other: Iterable[_T]) -> bool: ...
|
||||
def __gt__(self, other: Iterable[_T]) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def symmetric_difference(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
|
||||
def __xor__(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
|
||||
def symmetric_difference_update(self, other: Iterable[_S]) -> None: ...
|
||||
def __ixor__(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
|
||||
def union(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
|
||||
def __or__(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ...
|
||||
def isdisjoint(self, other: Iterable[_T]) -> bool: ...
|
||||
@@ -117,8 +117,10 @@ class Action:
|
||||
option_string: _Text = ...) -> None: ...
|
||||
|
||||
class Namespace:
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
def __getattr__(self, name: _Text) -> Any: ...
|
||||
def __setattr__(self, name: _Text, value: Any) -> None: ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
|
||||
class FileType:
|
||||
if sys.version_info >= (3, 4):
|
||||
|
||||
@@ -2,28 +2,28 @@ from abc import abstractmethod
|
||||
import asyncore
|
||||
import socket
|
||||
import sys
|
||||
from typing import Union, Tuple, Sequence
|
||||
from typing import Optional, Sequence, Tuple, Union
|
||||
|
||||
|
||||
class simple_producer:
|
||||
def __init__(self, data: str, buffer_size: int = ...) -> None: ...
|
||||
def more(self) -> str: ...
|
||||
def __init__(self, data: bytes, buffer_size: int = ...) -> None: ...
|
||||
def more(self) -> bytes: ...
|
||||
|
||||
class async_chat (asyncore.dispatcher):
|
||||
class async_chat(asyncore.dispatcher):
|
||||
ac_in_buffer_size = ... # type: int
|
||||
ac_out_buffer_size = ... # type: int
|
||||
def __init__(self, sock: socket.socket = None, map: asyncore._maptype = None) -> None: ...
|
||||
def __init__(self, sock: Optional[socket.socket] = None, map: Optional[asyncore._maptype] = None) -> None: ...
|
||||
|
||||
@abstractmethod
|
||||
def collect_incoming_data(self, data: str) -> None: ...
|
||||
def collect_incoming_data(self, data: bytes) -> None: ...
|
||||
@abstractmethod
|
||||
def found_terminator(self) -> None: ...
|
||||
def set_terminator(self, term: Union[str, int, None]) -> None: ...
|
||||
def get_terminator(self) -> Union[str, int, None]: ...
|
||||
def set_terminator(self, term: Union[bytes, int, None]) -> None: ...
|
||||
def get_terminator(self) -> Union[bytes, int, None]: ...
|
||||
def handle_read(self) -> None: ...
|
||||
def handle_write(self) -> None: ...
|
||||
def handle_close(self) -> None: ...
|
||||
def push(self, data: str) -> None: ...
|
||||
def push(self, data: bytes) -> None: ...
|
||||
def push_with_producer(self, producer: simple_producer) -> None: ...
|
||||
def readable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
@@ -33,9 +33,9 @@ class async_chat (asyncore.dispatcher):
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
class fifo:
|
||||
def __init__(self, list: Sequence[Union[str, simple_producer]] = ...) -> None: ...
|
||||
def __init__(self, list: Sequence[Union[bytes, simple_producer]] = ...) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def is_empty(self) -> bool: ...
|
||||
def first(self) -> str: ...
|
||||
def push(self, data: Union[str, simple_producer]) -> None: ...
|
||||
def pop(self) -> Tuple[int, str]: ...
|
||||
def first(self) -> bytes: ...
|
||||
def push(self, data: Union[bytes, simple_producer]) -> None: ...
|
||||
def pop(self) -> Tuple[int, bytes]: ...
|
||||
|
||||
@@ -25,7 +25,7 @@ def poll2(timeout: float = ..., map: _maptype = ...) -> None: ...
|
||||
|
||||
poll3 = poll2
|
||||
|
||||
def loop(timeout: float = ..., use_poll: bool = ..., map: _maptype = ..., count: int = None) -> None: ...
|
||||
def loop(timeout: float = ..., use_poll: bool = ..., map: _maptype = ..., count: Optional[int] = None) -> None: ...
|
||||
|
||||
|
||||
# Not really subclass of socket.socket; it's only delegation.
|
||||
@@ -39,7 +39,7 @@ class dispatcher:
|
||||
closing = ... # type: bool
|
||||
ignore_log_types = ... # type: frozenset[str]
|
||||
|
||||
def __init__(self, sock: socket.socket = None, map: _maptype = ...) -> None: ...
|
||||
def __init__(self, sock: Optional[socket.socket] = None, map: _maptype = ...) -> None: ...
|
||||
def add_channel(self, map: _maptype = ...) -> None: ...
|
||||
def del_channel(self, map: _maptype = ...) -> None: ...
|
||||
def create_socket(self, family: int, type: int) -> None: ...
|
||||
@@ -47,10 +47,15 @@ class dispatcher:
|
||||
def set_reuse_addr(self) -> None: ...
|
||||
def readable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
def listen(self, backlog: int) -> None: ...
|
||||
def bind(self, address: Union[tuple, str]) -> None: ...
|
||||
def connect(self, address: Union[tuple, str]) -> None: ...
|
||||
def accept(self) -> Optional[Tuple[socket.socket, Any]]: ...
|
||||
def recv(self, buffer_size: int) -> str: ...
|
||||
def log(self, message: Any) -> None: ...
|
||||
def send(self, data: bytes) -> int: ...
|
||||
def recv(self, buffer_size: int) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
def log(self, message: Any) -> None: ...
|
||||
def log_info(self, message: Any, type: str = ...) -> None: ...
|
||||
def handle_read_event(self) -> None: ...
|
||||
def handle_connect_event(self) -> None: ...
|
||||
@@ -63,46 +68,51 @@ class dispatcher:
|
||||
def handle_connect(self) -> None: ...
|
||||
def handle_accept(self) -> None: ...
|
||||
def handle_close(self) -> None: ...
|
||||
def detach(self) -> int: ...
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
# return value is an address
|
||||
def getpeername(self) -> Any: ...
|
||||
def getsockname(self) -> Any: ...
|
||||
if sys.version_info < (3, 5):
|
||||
# Historically, some methods were "imported" from `self.socket` by
|
||||
# means of `__getattr__`. This was long deprecated, and as of Python
|
||||
# 3.5 has been removed; simply call the relevant methods directly on
|
||||
# self.socket if necessary.
|
||||
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: int) -> int: ...
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
|
||||
def detach(self) -> int: ...
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
def gettimeout(self) -> float: ...
|
||||
def ioctl(self, control: object,
|
||||
option: Tuple[int, int, int]) -> None: ...
|
||||
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 = ...,
|
||||
newline: str = ...) -> Any:
|
||||
...
|
||||
# return value is an address
|
||||
def getpeername(self) -> Any: ...
|
||||
def getsockname(self) -> Any: ...
|
||||
|
||||
# return type is an address
|
||||
def recvfrom(self, bufsize: int, flags: int = ...) -> Any: ...
|
||||
def recvfrom_into(self, buffer: str, nbytes: int, flags: int = ...) -> Any: ...
|
||||
def recv_into(self, buffer: str, nbytes: int, flags: int = ...) -> Any: ...
|
||||
def send(self, data: str, flags: int = ...) -> Optional[int]: ...
|
||||
def sendall(self, data: str, flags: int = ...) -> None: ...
|
||||
def sendto(self, data: str, address: Union[tuple, str], flags: int = ...) -> int: ...
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
def settimeout(self, value: Union[float, None]) -> None: ...
|
||||
def setsockopt(self, level: int, optname: int, value: Union[int, str]) -> None: ...
|
||||
def shutdown(self, how: int) -> None: ...
|
||||
@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 ioctl(self, control: object,
|
||||
option: Tuple[int, int, 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 = ...,
|
||||
newline: str = ...) -> Any:
|
||||
...
|
||||
|
||||
# return type is an address
|
||||
def recvfrom(self, bufsize: int, flags: int = ...) -> Any: ...
|
||||
def recvfrom_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
|
||||
def recv_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
|
||||
def sendall(self, data: bytes, flags: int = ...) -> None: ...
|
||||
def sendto(self, data: bytes, address: Union[tuple, str], flags: int = ...) -> int: ...
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
def settimeout(self, value: Union[float, None]) -> None: ...
|
||||
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
|
||||
def shutdown(self, how: int) -> None: ...
|
||||
|
||||
class dispatcher_with_send(dispatcher):
|
||||
def __init__(self, sock: socket.socket = ..., map: _maptype = ...) -> None: ...
|
||||
def initiate_send(self) -> None: ...
|
||||
def handle_write(self) -> None: ...
|
||||
# incompatible signature:
|
||||
# def send(self, data: str) -> Optional[int]: ...
|
||||
# def send(self, data: bytes) -> Optional[int]: ...
|
||||
|
||||
def compact_traceback() -> Tuple[Tuple[str, str, str], type, type, str]: ...
|
||||
def close_all(map: _maptype = ..., ignore_all: bool = ...) -> None: ...
|
||||
@@ -113,16 +123,16 @@ class file_wrapper:
|
||||
fd = ... # type: int
|
||||
|
||||
def __init__(self, fd: int) -> None: ...
|
||||
def recv(self, bufsize: int, flags: int = ...) -> str: ...
|
||||
def send(self, data: str, flags: int = ...) -> int: ...
|
||||
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
|
||||
def send(self, data: bytes, flags: int = ...) -> int: ...
|
||||
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: int) -> int: ...
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
|
||||
|
||||
def read(self, bufsize: int, flags: int = ...) -> str: ...
|
||||
def write(self, data: str, flags: int = ...) -> int: ...
|
||||
def read(self, bufsize: int, flags: int = ...) -> bytes: ...
|
||||
def write(self, data: bytes, flags: int = ...) -> int: ...
|
||||
|
||||
def close(self) -> None: ...
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# Stubs for base64
|
||||
|
||||
from typing import IO, Union, Text
|
||||
import sys
|
||||
|
||||
if sys.version_info < (3,):
|
||||
_encodable = Union[bytes, Text]
|
||||
_decodable = Union[bytes, Text]
|
||||
elif sys.version_info < (3, 3):
|
||||
_encodable = bytes
|
||||
_decodable = bytes
|
||||
elif sys.version_info[:2] == (3, 3):
|
||||
_encodable = bytes
|
||||
_decodable = Union[bytes, str]
|
||||
elif sys.version_info >= (3, 4):
|
||||
_encodable = Union[bytes, bytearray, memoryview]
|
||||
_decodable = Union[bytes, bytearray, memoryview, str]
|
||||
|
||||
def b64encode(s: _encodable, altchars: bytes = ...) -> bytes: ...
|
||||
def b64decode(s: _decodable, altchars: bytes = ...,
|
||||
validate: bool = ...) -> bytes: ...
|
||||
def standard_b64encode(s: _encodable) -> bytes: ...
|
||||
def standard_b64decode(s: _decodable) -> bytes: ...
|
||||
def urlsafe_b64encode(s: _encodable) -> bytes: ...
|
||||
def urlsafe_b64decode(s: _decodable) -> bytes: ...
|
||||
def b32encode(s: _encodable) -> bytes: ...
|
||||
def b32decode(s: _decodable, casefold: bool = ...,
|
||||
map01: bytes = ...) -> bytes: ...
|
||||
def b16encode(s: _encodable) -> bytes: ...
|
||||
def b16decode(s: _decodable, casefold: bool = ...) -> bytes: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
def a85encode(b: _encodable, *, foldspaces: bool = ..., wrapcol: int = ...,
|
||||
pad: bool = ..., adobe: bool = ...) -> bytes: ...
|
||||
def a85decode(b: _decodable, *, foldspaces: bool = ...,
|
||||
adobe: bool = ..., ignorechars: Union[str, bytes] = ...) -> bytes: ...
|
||||
def b85encode(b: _encodable, pad: bool = ...) -> bytes: ...
|
||||
def b85decode(b: _decodable) -> bytes: ...
|
||||
|
||||
def decode(input: IO[bytes], output: IO[bytes]) -> None: ...
|
||||
def decodebytes(s: bytes) -> bytes: ...
|
||||
def decodestring(s: bytes) -> bytes: ...
|
||||
def encode(input: IO[bytes], output: IO[bytes]) -> None: ...
|
||||
def encodebytes(s: bytes) -> bytes: ...
|
||||
def encodestring(s: bytes) -> bytes: ...
|
||||
@@ -0,0 +1,45 @@
|
||||
# Stubs for binascii
|
||||
|
||||
# Based on http://docs.python.org/3.2/library/binascii.html
|
||||
|
||||
import sys
|
||||
from typing import Union, Text
|
||||
|
||||
|
||||
if sys.version_info < (3,):
|
||||
# Python 2 accepts unicode ascii pretty much everywhere.
|
||||
_Bytes = Union[bytes, Text]
|
||||
_Ascii = Union[bytes, Text]
|
||||
elif sys.version_info < (3, 3):
|
||||
# Python 3.2 and below only accepts bytes.
|
||||
_Bytes = bytes
|
||||
_Ascii = bytes
|
||||
else:
|
||||
# But since Python 3.3 ASCII-only unicode strings are accepted by the
|
||||
# a2b_* functions.
|
||||
_Bytes = bytes
|
||||
_Ascii = Union[bytes, Text]
|
||||
|
||||
def a2b_uu(string: _Ascii) -> bytes: ...
|
||||
def b2a_uu(data: _Bytes) -> bytes: ...
|
||||
def a2b_base64(string: _Ascii) -> bytes: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def b2a_base64(data: _Bytes, *, newline: bool = ...) -> bytes: ...
|
||||
else:
|
||||
def b2a_base64(data: _Bytes) -> bytes: ...
|
||||
def a2b_qp(string: _Ascii, header: bool = ...) -> bytes: ...
|
||||
def b2a_qp(data: _Bytes, quotetabs: bool = ..., istext: bool = ...,
|
||||
header: bool = ...) -> bytes: ...
|
||||
def a2b_hqx(string: _Ascii) -> bytes: ...
|
||||
def rledecode_hqx(data: _Bytes) -> bytes: ...
|
||||
def rlecode_hqx(data: _Bytes) -> bytes: ...
|
||||
def b2a_hqx(data: _Bytes) -> bytes: ...
|
||||
def crc_hqx(data: _Bytes, crc: int) -> int: ...
|
||||
def crc32(data: _Bytes, crc: int = ...) -> int: ...
|
||||
def b2a_hex(data: _Bytes) -> bytes: ...
|
||||
def hexlify(data: _Bytes) -> bytes: ...
|
||||
def a2b_hex(hexstr: _Ascii) -> bytes: ...
|
||||
def unhexlify(hexlify: _Ascii) -> bytes: ...
|
||||
|
||||
class Error(Exception): ...
|
||||
class Incomplete(Exception): ...
|
||||
@@ -1,21 +1,21 @@
|
||||
# Stubs for bz2
|
||||
|
||||
from typing import Any, BinaryIO, TextIO, IO, Union
|
||||
from typing import Any, BinaryIO, TextIO, IO, Optional, Union
|
||||
|
||||
def compress(data: bytes, compresslevel: int = ...) -> bytes: ...
|
||||
def decompress(data: bytes) -> bytes: ...
|
||||
|
||||
def open(filename: Union[str, bytes, IO[Any]],
|
||||
mode: str = 'rb',
|
||||
encoding: str = None,
|
||||
errors: str = None,
|
||||
newline: str = None) -> IO[Any]: ...
|
||||
encoding: Optional[str] = None,
|
||||
errors: Optional[str] = None,
|
||||
newline: Optional[str] = None) -> IO[Any]: ...
|
||||
|
||||
class BZ2File(BinaryIO):
|
||||
def __init__(self,
|
||||
filename: Union[str, bytes, IO[Any]],
|
||||
mode: str = "r",
|
||||
buffering: Any = None,
|
||||
buffering: Optional[Any] = None,
|
||||
compresslevel: int = 9) -> None: ...
|
||||
|
||||
class BZ2Compressor(object):
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
import datetime
|
||||
import sys
|
||||
from time import struct_time
|
||||
from typing import Any, Iterable, List, Optional, Sequence, Tuple, Union
|
||||
|
||||
|
||||
_LocaleType = Tuple[Optional[str], Optional[str]]
|
||||
|
||||
class IllegalMonthError(ValueError):
|
||||
def __init__(self, month: int) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
class IllegalWeekdayError(ValueError):
|
||||
def __init__(self, weekday: int) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
def isleap(year: int) -> bool: ...
|
||||
def leapdays(y1: int, y2: int) -> int: ...
|
||||
def weekday(year: int, month: int, day: int) -> int: ...
|
||||
def monthrange(year: int, month: int) -> Tuple[int, int]: ...
|
||||
|
||||
class Calendar:
|
||||
def __init__(self, firstweekday: int = ...) -> None: ...
|
||||
def getfirstweekday(self) -> int: ...
|
||||
def setfirstweekday(self, firstweekday: int) -> None: ...
|
||||
def iterweekdays(self) -> Iterable[int]: ...
|
||||
def itermonthdates(self, year: int, month: int) -> Iterable[datetime.date]: ...
|
||||
def itermonthdays2(self, year: int, month: int) -> Iterable[Tuple[int, int]]: ...
|
||||
def itermonthdays(self, year: int, month: int) -> Iterable[int]: ...
|
||||
def monthdatescalendar(self, year: int, month: int) -> List[List[datetime.date]]: ...
|
||||
def monthdays2calendar(self, year: int, month: int) -> List[List[Tuple[int, int]]]: ...
|
||||
def monthdayscalendar(self, year: int, month: int) -> List[List[int]]: ...
|
||||
def yeardatescalendar(self, year: int, width: int = ...) -> List[List[int]]: ...
|
||||
def yeardays2calendar(self, year: int, width: int = ...) -> List[List[Tuple[int, int]]]: ...
|
||||
def yeardayscalendar(self, year: int, width: int = ...) -> List[List[int]]: ...
|
||||
|
||||
class TextCalendar(Calendar):
|
||||
def prweek(self, theweek: int, width: int) -> None: ...
|
||||
def formatday(self, day: int, weekday: int, width: int) -> str: ...
|
||||
def formatweek(self, theweek: int, width: int) -> str: ...
|
||||
def formatweekday(self, day: int, width: int) -> str: ...
|
||||
def formatweekheader(self, width: int) -> str: ...
|
||||
def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ...
|
||||
def prmonth(self, theyear: int, themonth: int, w: int = ..., l: int = ...) -> None: ...
|
||||
def formatmonth(self, theyear: int, themonth: int, w: int = ..., l: int = ...) -> str: ...
|
||||
def formatyear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> str: ...
|
||||
def pryear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ...
|
||||
|
||||
def firstweekday() -> int: ...
|
||||
def monthcalendar(year: int, month: int) -> List[List[int]]: ...
|
||||
def prweek(theweek: int, width: int) -> None: ...
|
||||
def week(theweek: int, width: int) -> str: ...
|
||||
def weekheader(width: int) -> str: ...
|
||||
def prmonth(theyear: int, themonth: int, w: int = ..., l: int = ...) -> None: ...
|
||||
def month(theyear: int, themonth: int, w: int = ..., l: int = ...) -> str: ...
|
||||
def calendar(theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> str: ...
|
||||
def prcal(theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ...
|
||||
|
||||
class HTMLCalendar(Calendar):
|
||||
def formatday(self, day: int, weekday: int) -> str: ...
|
||||
def formatweek(self, theweek: int) -> str: ...
|
||||
def formatweekday(self, day: int) -> str: ...
|
||||
def formatweekheader(self) -> str: ...
|
||||
def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
|
||||
def formatmonth(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
|
||||
def formatyear(self, theyear: int, width: int = ...) -> str: ...
|
||||
def formatyearpage(self, theyear: int, width: int = ..., css: Optional[str] = ..., encoding: Optional[str] = ...) -> str: ...
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
class TimeEncoding:
|
||||
def __init__(self, locale: _LocaleType) -> None: ...
|
||||
def __enter__(self) -> _LocaleType: ...
|
||||
def __exit__(self, *args) -> None: ...
|
||||
else:
|
||||
class different_locale:
|
||||
def __init__(self, locale: _LocaleType) -> None: ...
|
||||
def __enter__(self) -> _LocaleType: ...
|
||||
def __exit__(self, *args) -> None: ...
|
||||
|
||||
class LocaleTextCalendar(TextCalendar):
|
||||
def __init__(self, firstweekday: int = ..., locale: Optional[_LocaleType] = ...) -> None: ...
|
||||
def formatweekday(self, day: int, width: int) -> str: ...
|
||||
def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ...
|
||||
|
||||
class LocaleHTMLCalendar(HTMLCalendar):
|
||||
def __init__(self, firstweekday: int = ..., locale: Optional[_LocaleType] = ...) -> None: ...
|
||||
def formatweekday(self, day: int) -> str: ...
|
||||
def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
|
||||
|
||||
c = ... # type: TextCalendar
|
||||
def setfirstweekday(firstweekday: int) -> None: ...
|
||||
def format(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ...
|
||||
def formatstring(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ...
|
||||
def timegm(tuple: Union[Tuple[int, ...], struct_time]) -> int: ...
|
||||
|
||||
# Data attributes
|
||||
day_name = ... # type: Sequence[str]
|
||||
day_abbr = ... # type: Sequence[str]
|
||||
month_name = ... # type: Sequence[str]
|
||||
month_abbr = ... # type: Sequence[str]
|
||||
|
||||
# Below constants are not in docs or __all__, but enough people have used them
|
||||
# they are now effectively public.
|
||||
|
||||
MONDAY = ... # type: int
|
||||
TUESDAY = ... # type: int
|
||||
WEDNESDAY = ... # type: int
|
||||
THURSDAY = ... # type: int
|
||||
FRIDAY = ... # type: int
|
||||
SATURDAY = ... # type: int
|
||||
SUNDAY = ... # type: int
|
||||
@@ -38,6 +38,7 @@ class MiniFieldStorage:
|
||||
|
||||
|
||||
class FieldStorage(object):
|
||||
FieldStorageClass = ... # type: Optional[type]
|
||||
keep_blank_values = ... # type: int
|
||||
strict_parsing = ... # type: int
|
||||
qs_on_post = ... # type: Optional[str]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user