mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-06-19 15:42:21 +08:00
Compare commits
364 Commits
master
...
sqlite3_cursor
| Author | SHA1 | Date | |
|---|---|---|---|
| 74b5289e33 | |||
| 3e638aa3c3 | |||
| fda384fe0a | |||
| a06abc5dff | |||
| 9b63192390 | |||
| 39ebd62e71 | |||
| 4766ca0846 | |||
| 6b321548c4 | |||
| 9a32f0d26a | |||
| 86775c803e | |||
| 97f830030c | |||
| d215f502c6 | |||
| b585c96e5d | |||
| 3934da12f6 | |||
| e8647d2d1d | |||
| f7f68607ab | |||
| 92716c6821 | |||
| 359817bde9 | |||
| 5fdd6ad1a5 | |||
| a9a4fd0d42 | |||
| 74ac70bd28 | |||
| 615fa41c25 | |||
| 595d02363a | |||
| 643b955edb | |||
| 23c531df5a | |||
| 693678b4c3 | |||
| e2cf7c1bcf | |||
| 56688240a1 | |||
| 41bf6a1982 | |||
| c76a298ffa | |||
| 90004af132 | |||
| 1f0dc6ee05 | |||
| a89f883878 | |||
| 91f445ef11 | |||
| c0d46a2035 | |||
| 1871e50936 | |||
| 036a278624 | |||
| 9c87b24041 | |||
| cd45623ab7 | |||
| 8df632bca5 | |||
| c53bc5a7ab | |||
| e065803980 | |||
| 838e02334e | |||
| 34d68ab0a2 | |||
| 8b6cd5c3f0 | |||
| ba520034c7 | |||
| 107eaeb3d2 | |||
| 66778639a5 | |||
| 05780a0d11 | |||
| e55dad5dd0 | |||
| 2f65683d7b | |||
| 97ecd2b91f | |||
| d60b7ae26d | |||
| 79d4e0dd08 | |||
| e4677d9ed4 | |||
| add0b5e930 | |||
| f39c102eb8 | |||
| 99a6fb3108 | |||
| 047caa9096 | |||
| 66c3945ca4 | |||
| 7e27bf6bde | |||
| 86135edb6d | |||
| 4b8c6bbea1 | |||
| 616cb0bb65 | |||
| cd5cd12a35 | |||
| 603458ba09 | |||
| c8405bb5d9 | |||
| b112c20dad | |||
| b5b9a3959d | |||
| 5e9f66cb62 | |||
| 4770059894 | |||
| aae01b8de0 | |||
| 5e051d8848 | |||
| 2023394b37 | |||
| e6c467af82 | |||
| beaf306d12 | |||
| 9c724e9e60 | |||
| 87d7dd3d95 | |||
| 6a7c2011cc | |||
| 72ff7b94e5 | |||
| 124111534a | |||
| bf944dbf94 | |||
| 9feb21d029 | |||
| 92aa1ee9c2 | |||
| ce8d1da5ce | |||
| 4f13e710c3 | |||
| f28691261a | |||
| ec7960a8cb | |||
| 2b9dc7b9c2 | |||
| 3fbebc78cb | |||
| ffd73b3e8e | |||
| bf862d9079 | |||
| 38fbdc9490 | |||
| 966f8d24e6 | |||
| fd7f1063d5 | |||
| fa9e1ab445 | |||
| 6b68fb04c9 | |||
| 7c6104ddfe | |||
| 6e4f6403ac | |||
| 6058c23136 | |||
| 299d89ab76 | |||
| 67629a14a7 | |||
| 89f0f63502 | |||
| b969ead0ce | |||
| dfe68625ec | |||
| 6c42f6bb2f | |||
| add16d2715 | |||
| 7e99848b2c | |||
| 6b55f5c498 | |||
| 0501e2b329 | |||
| 6507875f28 | |||
| 950f391704 | |||
| de26a3d109 | |||
| 2bd1b75641 | |||
| 91b72d49c7 | |||
| 62bbdf856c | |||
| 8ec25708d9 | |||
| 583784d94c | |||
| 6354bc8a10 | |||
| 61d5f76a1d | |||
| 6a92ae6295 | |||
| bb12f3bdea | |||
| 036abc7fda | |||
| 9b0922166a | |||
| d41bcd39e1 | |||
| 8a7d61741d | |||
| d0beab9b8e | |||
| fc23c8274f | |||
| eca93753ee | |||
| 1a932ce26a | |||
| 57384ce033 | |||
| f0ccb325aa | |||
| 07c8675ba5 | |||
| bd7222c396 | |||
| 3a2fdfd45d | |||
| 0914d50b49 | |||
| 824e94a933 | |||
| 3ee8fc2242 | |||
| 50961d45a1 | |||
| 4027add6b3 | |||
| d82d3396e7 | |||
| 256b3ce8ab | |||
| a6f146e651 | |||
| 6e4708ebf3 | |||
| 7710e925ca | |||
| 447691cf46 | |||
| 717cd1f96f | |||
| b9342eca0a | |||
| 3743b64b07 | |||
| 79a8f0b8c6 | |||
| cd418e9546 | |||
| 83589844c9 | |||
| 90aa27b54a | |||
| 0a426d8a8e | |||
| 41d23a67f6 | |||
| e62857f851 | |||
| fa571fb224 | |||
| 9a1d205f34 | |||
| c38cf6736e | |||
| eeb8daa467 | |||
| 455f25a5c7 | |||
| ad881f94d7 | |||
| 0abb50e20a | |||
| c32e1e2280 | |||
| 23b353303b | |||
| 785d7838e1 | |||
| a2834cf24d | |||
| aaff561ef6 | |||
| c441a1f5b8 | |||
| ed4b1de0ad | |||
| 412b9e74d5 | |||
| 468d13a205 | |||
| 23232c056c | |||
| 95185fa9cf | |||
| b336182b69 | |||
| 1e881ad156 | |||
| d4727c39f1 | |||
| c0371df172 | |||
| 60bdf60eda | |||
| ac35a18ad6 | |||
| 4e1a45a0bb | |||
| d1ed2b275f | |||
| efdbefee86 | |||
| e0cc8bdafb | |||
| c33239b011 | |||
| 3f8c2169d1 | |||
| 829c646d69 | |||
| c1ec292344 | |||
| 01b7002a89 | |||
| c879ff05aa | |||
| a011d1945e | |||
| c65b5cc61c | |||
| 4d662f0f49 | |||
| 0602840cc2 | |||
| 9488b58fb3 | |||
| 8b28753b64 | |||
| ce0dc8a23d | |||
| 4c63939585 | |||
| babc0c1912 | |||
| 895ae0fd9b | |||
| d0f3eb2d6b | |||
| 2edb36e993 | |||
| 2b97bb904a | |||
| 8d053f139f | |||
| 5ccf017ca0 | |||
| 686e21d330 | |||
| c9f19b1d72 | |||
| 668988fa8c | |||
| 3fc8aec425 | |||
| efb4af0108 | |||
| 1d21315773 | |||
| b94fa842eb | |||
| abc241bd35 | |||
| f9300ed1ed | |||
| 99e8ed42a4 | |||
| ae881faaf1 | |||
| d78747c0f0 | |||
| f53f52de57 | |||
| a48abb4546 | |||
| cd1a0c592a | |||
| 3e4a251b2b | |||
| 282405696e | |||
| 03b38d4d2e | |||
| ce0f5b226f | |||
| 04bcb89aea | |||
| 75ccbdcab5 | |||
| 72010bc5dc | |||
| 1ab5145124 | |||
| e252094354 | |||
| d5a918de7b | |||
| b2cd972b17 | |||
| c7417e8b3f | |||
| c0625d3280 | |||
| fab2ee0d7c | |||
| b294782183 | |||
| 3cfc3150f0 | |||
| 5638d29203 | |||
| 0ee7c3c38b | |||
| b873894e16 | |||
| 1edd6cd8a8 | |||
| 679e1a9a8c | |||
| 15b7cdaf40 | |||
| 26f575130c | |||
| baea5a7bc3 | |||
| 0dc3bf941a | |||
| 628eee29f7 | |||
| c579f91077 | |||
| 3f6cec9872 | |||
| 6f01493edc | |||
| 0dea39cb3c | |||
| 50f1988650 | |||
| 29771aa1ee | |||
| d05a9d3d83 | |||
| 1dc24e1c67 | |||
| 3c4141982e | |||
| 02401c836f | |||
| f2fdb54765 | |||
| edee7cfb3c | |||
| 4c8d577d68 | |||
| c3b70d4224 | |||
| 29dde6c883 | |||
| c6cbe4da66 | |||
| bd2d0fcc85 | |||
| 32a89809f0 | |||
| 568f1ea555 | |||
| 15aa18d0a2 | |||
| 9ccf9356bf | |||
| 4697adcb1a | |||
| c8e7d98c1f | |||
| c356316c6f | |||
| df8ecf5a67 | |||
| e9d1f86591 | |||
| b20e5b6c14 | |||
| 32ee49c79c | |||
| c9f9530224 | |||
| b3f7be523a | |||
| bf50612d76 | |||
| 9a7b286c66 | |||
| 0177dedc42 | |||
| 8794e40d41 | |||
| 322be1b9e7 | |||
| 8e0d288ea4 | |||
| 67d091db15 | |||
| 9dcdc7d481 | |||
| 9379cedfa7 | |||
| 4072ad82fb | |||
| 90c2c22961 | |||
| dad16f2d43 | |||
| 40215d1fa3 | |||
| 09d1055cd3 | |||
| 508f992730 | |||
| 8e89faa90f | |||
| 3ad3ed82c7 | |||
| e2ec5d0525 | |||
| f76b7b273b | |||
| 2a57ce2cec | |||
| 40124b5f4c | |||
| 34b47101dd | |||
| 4ae4714e00 | |||
| b43e1d674f | |||
| f5c107cacd | |||
| 1436cfdef9 | |||
| 84e6492d7e | |||
| 4af283e1ac | |||
| 3e700224ba | |||
| 75d9228b02 | |||
| 668d050476 | |||
| e1e5c83795 | |||
| c66699800e | |||
| 8b66e08745 | |||
| 47450629c9 | |||
| 3272307933 | |||
| 5dc89fe8cf | |||
| 7e9e91cb7b | |||
| 8131bfc3f6 | |||
| 64b12bf7f1 | |||
| e25c0cb128 | |||
| bdd49d0f3a | |||
| b0c9fa4530 | |||
| ada0570efc | |||
| 9941616b9e | |||
| 2b6a99c39c | |||
| 58221cf20e | |||
| 1763f51c0d | |||
| 2e10326b50 | |||
| d149fe435c | |||
| aa56af7dce | |||
| 38f253ed69 | |||
| 01c2fa5a14 | |||
| fcb97fe8f1 | |||
| 5447ff6bfe | |||
| 6258e7ddfd | |||
| 1efebf78e4 | |||
| d36a519b95 | |||
| 1f740a7926 | |||
| 8ffe20fc22 | |||
| 8e7c32846f | |||
| e4a9cd580c | |||
| b9101e9c5e | |||
| 5327484176 | |||
| 901cb33a3c | |||
| ed2a851ed8 | |||
| 55a566340a | |||
| d64a26cf99 | |||
| e7184d6dfc | |||
| 61eb99664b | |||
| 87f96dc1f0 | |||
| 5c94b58752 | |||
| db5fc492aa | |||
| 40c4e4ff3d | |||
| 0e5b3770f8 | |||
| d6e2b02f72 | |||
| a7785151aa | |||
| 233f2abf19 | |||
| 018ecb3f16 | |||
| f8093d63cd | |||
| dd244d1200 | |||
| 6061ca404e | |||
| d8e14d6ead | |||
| 020449a1ed | |||
| 53500c8750 | |||
| 260369e6e7 | |||
| 45266c9c32 | |||
| 07d4938251 |
@@ -5,7 +5,7 @@
|
||||
# 7155 E302 expected 2 blank lines
|
||||
# 1463 F401 imported but unused
|
||||
# 967 E701 multiple statements on one line (colon)
|
||||
# 457 F811 redefinition
|
||||
# 457 F811 redefinition (should be fixed in pyflakes 2.1.2)
|
||||
# 390 E305 expected 2 blank lines
|
||||
# 4 E741 ambiguous variable name
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
[flake8]
|
||||
ignore = F401, F403, F405, F811, E301, E302, E305, E501, E701, E704, E741, B303, W504
|
||||
# We are checking with Python 3 but many of the stubs are Python 2 stubs.
|
||||
# A nice future improvement would be to provide separate .flake8
|
||||
# configurations for Python 2 and Python 3 files.
|
||||
builtins = StandardError,apply,basestring,buffer,cmp,coerce,execfile,file,intern,long,raw_input,reduce,reload,unichr,unicode,xrange
|
||||
exclude = .venv*,@*,.git
|
||||
max-line-length = 130
|
||||
|
||||
+23
-22
@@ -1,30 +1,31 @@
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
language: python
|
||||
python: 3.7
|
||||
python: 3.8
|
||||
|
||||
matrix:
|
||||
jobs:
|
||||
include:
|
||||
- name: "pytype"
|
||||
python: 3.6
|
||||
env:
|
||||
- TEST_CMD="./tests/pytype_test.py"
|
||||
- INSTALL="test"
|
||||
- name: "mypy"
|
||||
env:
|
||||
- TEST_CMD="./tests/mypy_test.py"
|
||||
- INSTALL="mypy"
|
||||
install: pip install -r requirements-tests-py3.txt
|
||||
script: ./tests/pytype_test.py
|
||||
- name: "mypy (typed-ast)"
|
||||
python: 3.7
|
||||
install: pip install -U git+git://github.com/python/mypy git+git://github.com/python/typed_ast
|
||||
script: ./tests/mypy_test.py --platform=linux
|
||||
- name: "mypy (ast)"
|
||||
python: 3.8
|
||||
install: pip install -U git+git://github.com/python/mypy
|
||||
script: ./tests/mypy_test.py --platform=linux
|
||||
- name: "mypy (Windows)"
|
||||
install: pip install -U git+git://github.com/python/mypy
|
||||
script: ./tests/mypy_test.py --platform=win32
|
||||
- name: "mypy (Darwin)"
|
||||
install: pip install -U git+git://github.com/python/mypy
|
||||
script: ./tests/mypy_test.py --platform=darwin
|
||||
- name: "mypy self test"
|
||||
env: TEST_CMD="./tests/mypy_selftest.py"
|
||||
script: ./tests/mypy_selftest.py
|
||||
- name: "check file consistency"
|
||||
env: TEST_CMD="./tests/check_consistent.py"
|
||||
script: ./tests/check_consistent.py
|
||||
- name: "flake8"
|
||||
env:
|
||||
- TEST_CMD="flake8"
|
||||
- INSTALL="test"
|
||||
|
||||
install:
|
||||
- if [[ $INSTALL == 'test' ]]; then pip install -r requirements-tests-py3.txt; fi
|
||||
- if [[ $INSTALL == 'mypy' ]]; then pip install -U git+git://github.com/python/mypy git+git://github.com/python/typed_ast; fi
|
||||
|
||||
script:
|
||||
- $TEST_CMD
|
||||
install: pip install -r requirements-tests-py3.txt
|
||||
script: flake8
|
||||
|
||||
+23
-30
@@ -11,13 +11,11 @@ are important to the project's success.
|
||||
1. Read the [README.md file](README.md).
|
||||
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).
|
||||
* Small fixes and additions can be submitted directly as pull requests,
|
||||
but [contact us](#discussion) before starting significant work.
|
||||
* Create your stubs [conforming to the coding style](#stub-file-coding-style).
|
||||
* 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)
|
||||
4. [Submit your changes](#submitting-changes) by opening a pull request.
|
||||
5. You can expect a reply within a few days:
|
||||
* Diffs are merged when considered ready by the core team.
|
||||
* Feel free to ping the core team if your pull request goes without
|
||||
@@ -103,21 +101,6 @@ recommend starting by opening an issue laying out what you want to do.
|
||||
That lets a conversation happen early in case other contributors disagree
|
||||
with what you'd like to do or have ideas that will help you do it.
|
||||
|
||||
### Adding a new library
|
||||
|
||||
If you want to submit type stubs for a new library, you need to
|
||||
**contact the maintainers of the original library** first to let them
|
||||
know and **get their permission**. Do it by opening an issue on their
|
||||
project's bug tracker. This gives them the opportunity to
|
||||
consider adopting type hints directly in their codebase (which you
|
||||
should prefer to external type stubs). When the project owners agree
|
||||
for you to submit stubs here or you do not receive a reply within
|
||||
one month, open a pull request **referencing the
|
||||
issue where you asked for permission**.
|
||||
|
||||
Make sure your changes pass the tests (the [README](README.md#running-the-tests)
|
||||
has more information).
|
||||
|
||||
### What to include
|
||||
|
||||
Stubs should include the complete interface (classes, functions,
|
||||
@@ -237,7 +220,7 @@ rule is that they should be as concise as possible. Specifically:
|
||||
* use variable annotations instead of type comments, even for stubs
|
||||
that target older versions of Python;
|
||||
* for arguments with a type and a default, use spaces around the `=`.
|
||||
The code formatter [black](https://github.com/python/black) will format
|
||||
The code formatter [black](https://github.com/psf/black) will format
|
||||
stubs according to this standard.
|
||||
|
||||
Stub files should only contain information necessary for the type
|
||||
@@ -291,6 +274,15 @@ 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.
|
||||
|
||||
When adding type annotations for context manager classes, annotate
|
||||
the return type of `__exit__` as bool only if the context manager
|
||||
sometimes suppresses annotations -- if it sometimes returns `True`
|
||||
at runtime. If the context manager never suppresses exceptions,
|
||||
have the return type be either `None` or `Optional[bool]`. If you
|
||||
are not sure whether exceptions are suppressed or not or if the
|
||||
context manager is meant to be subclassed, pick `Optional[bool]`.
|
||||
See https://github.com/python/mypy/issues/7214 for more details.
|
||||
|
||||
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.
|
||||
@@ -306,8 +298,8 @@ 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, though stubs in the `3.7` directory will only be applied to versions
|
||||
3.7 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
|
||||
@@ -317,7 +309,7 @@ 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
|
||||
You can use checks like `if sys.version_info >= (3, 8):` to denote new
|
||||
functionality introduced in a given Python version or solve type
|
||||
differences. When doing so, only use one-tuples or two-tuples. This is
|
||||
because:
|
||||
@@ -330,17 +322,17 @@ because:
|
||||
regardless of the micro version used.
|
||||
|
||||
Because of this, if a given functionality was introduced in, say, Python
|
||||
3.4.4, your check:
|
||||
3.7.4, your check:
|
||||
|
||||
* should be expressed as `if sys.version_info >= (3, 4):`
|
||||
* should NOT be expressed as `if sys.version_info >= (3, 4, 4):`
|
||||
* should NOT be expressed as `if sys.version_info >= (3, 5):`
|
||||
* should be expressed as `if sys.version_info >= (3, 7):`
|
||||
* should NOT be expressed as `if sys.version_info >= (3, 7, 4):`
|
||||
* should NOT be expressed as `if sys.version_info >= (3, 8):`
|
||||
|
||||
This makes the type checker assume the functionality was also available
|
||||
in 3.4.0 - 3.4.3, which while *technically* incorrect is relatively
|
||||
in 3.7.0 - 3.7.3, which while *technically* incorrect is relatively
|
||||
harmless. This is a strictly better compromise than using the latter
|
||||
two forms, which would generate false positive errors for correct use
|
||||
under Python 3.4.4.
|
||||
under Python 3.7.4.
|
||||
|
||||
Note: in its current implementation, typeshed cannot contain stubs for
|
||||
multiple versions of the same third-party library. Prefer to generate
|
||||
@@ -380,3 +372,4 @@ Core developers should follow these rules when processing pull requests:
|
||||
* 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.
|
||||
* If stubs for a new library are submitted, notify the library's maintainers.
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
|
||||
[](https://travis-ci.org/python/typeshed)
|
||||
[](https://gitter.im/python/typing?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://github.com/python/typeshed/blob/master/CONTRIBUTING.md)
|
||||
|
||||
## About
|
||||
|
||||
Typeshed contains external type annotations for the Python standard library
|
||||
and Python builtins, as well as third party packages.
|
||||
and Python builtins, as well as third party packages as contributed by
|
||||
people external to those projects.
|
||||
|
||||
This data can e.g. be used for static analysis, type checking or type inference.
|
||||
|
||||
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.**
|
||||
it before submitting pull requests; do not report issues with annotations to
|
||||
the project the stubs are for, but instead report them here to typeshed.**
|
||||
|
||||
Typeshed supports Python versions 2.7 and 3.4 and up.
|
||||
Typeshed supports Python versions 2.7 and 3.5 and up.
|
||||
|
||||
## Using
|
||||
|
||||
@@ -44,10 +47,13 @@ pytype repo.
|
||||
|
||||
## Format
|
||||
|
||||
Each Python module is represented by a `.pyi` "stub". This is a normal Python
|
||||
file (i.e., it can be interpreted by Python 3), except all the methods are empty.
|
||||
Each Python module is represented by a `.pyi` "stub file". This is a
|
||||
syntactically valid Python file, although it usually cannot be run by
|
||||
Python 3 (since forward references don't require string quotes). All
|
||||
the methods are empty.
|
||||
|
||||
Python function annotations ([PEP 3107](https://www.python.org/dev/peps/pep-3107/))
|
||||
are used to describe the types the function has.
|
||||
are used to describe the signature of each function or method.
|
||||
|
||||
See [PEP 484](http://www.python.org/dev/peps/pep-0484/) for the exact
|
||||
syntax of the stub files and [CONTRIBUTING.md](CONTRIBUTING.md) for the
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
[tool.black]
|
||||
line_length = 130
|
||||
target_version = ["py37"]
|
||||
|
||||
[tool.isort]
|
||||
multi_line_output = 3
|
||||
include_trailing_comma = true
|
||||
force_grid_wrap = 0
|
||||
use_parentheses = true
|
||||
combine_as_imports = true
|
||||
line_length = 130
|
||||
@@ -1,6 +1,8 @@
|
||||
git+https://github.com/python/mypy.git@master
|
||||
typed-ast>=1.0.4
|
||||
flake8==3.6.0
|
||||
flake8-bugbear==18.8.0
|
||||
flake8-pyi==18.3.1
|
||||
pytype>=2019.5.15
|
||||
black==19.3b0
|
||||
flake8==3.7.8
|
||||
flake8-bugbear==19.8.0
|
||||
flake8-pyi==19.3.0
|
||||
isort==4.3.21
|
||||
pytype>=2019.10.17
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Stubs for BaseHTTPServer (Python 2.7)
|
||||
|
||||
from typing import Any, BinaryIO, Mapping, Optional, Tuple, Union
|
||||
from typing import Any, BinaryIO, Callable, Mapping, Optional, Tuple, Union
|
||||
import SocketServer
|
||||
import mimetools
|
||||
|
||||
@@ -8,9 +8,9 @@ class HTTPServer(SocketServer.TCPServer):
|
||||
server_name: str
|
||||
server_port: int
|
||||
def __init__(self, server_address: Tuple[str, int],
|
||||
RequestHandlerClass: type) -> None: ...
|
||||
RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ...
|
||||
|
||||
class BaseHTTPRequestHandler:
|
||||
class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
|
||||
client_address: Tuple[str, int]
|
||||
server: SocketServer.BaseServer
|
||||
close_connection: bool
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# Stubs for CGIHTTPServer (Python 2.7)
|
||||
|
||||
from typing import List
|
||||
import SimpleHTTPServer
|
||||
|
||||
class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
cgi_directories: List[str]
|
||||
def do_POST(self) -> None: ...
|
||||
@@ -55,8 +55,8 @@ class _Readable(Protocol):
|
||||
|
||||
class RawConfigParser:
|
||||
_dict: Any
|
||||
_sections: dict
|
||||
_defaults: dict
|
||||
_sections: Dict[Any, Any]
|
||||
_defaults: Dict[Any, Any]
|
||||
_optcre: Any
|
||||
SECTCRE: Any
|
||||
OPTCRE: Any
|
||||
@@ -86,12 +86,14 @@ class RawConfigParser:
|
||||
|
||||
class ConfigParser(RawConfigParser):
|
||||
_KEYCRE: Any
|
||||
def get(self, section: str, option: str, raw: bool = ..., vars: Optional[dict] = ...) -> Any: ...
|
||||
def items(self, section: str, raw: bool = ..., vars: Optional[dict] = ...) -> List[Tuple[str, Any]]: ...
|
||||
def get(self, section: str, option: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> Any: ...
|
||||
def items(self, section: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> List[Tuple[str, Any]]: ...
|
||||
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
|
||||
def _interpolation_replace(self, match: Any) -> str: ...
|
||||
|
||||
class SafeConfigParser(ConfigParser):
|
||||
_interpvar_re: Any
|
||||
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
|
||||
def _interpolate_some(self, option: str, accum: list, rest: str, section: str, map: dict, depth: int) -> None: ...
|
||||
def _interpolate_some(
|
||||
self, option: str, accum: List[Any], rest: str, section: str, map: Dict[Any, Any], depth: int,
|
||||
) -> None: ...
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
class CookieError(Exception): ...
|
||||
|
||||
class Morsel(dict):
|
||||
class Morsel(Dict[Any, Any]):
|
||||
key: Any
|
||||
def __init__(self): ...
|
||||
def __setitem__(self, K, V): ...
|
||||
@@ -14,7 +14,7 @@ class Morsel(dict):
|
||||
def js_output(self, attrs: Optional[Any] = ...): ...
|
||||
def OutputString(self, attrs: Optional[Any] = ...): ...
|
||||
|
||||
class BaseCookie(dict):
|
||||
class BaseCookie(Dict[Any, Any]):
|
||||
def value_decode(self, val): ...
|
||||
def value_encode(self, val): ...
|
||||
def __init__(self, input: Optional[Any] = ...): ...
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
# Stubs for Queue (Python 2)
|
||||
|
||||
from collections import deque
|
||||
from typing import Any, TypeVar, Generic, Optional
|
||||
from typing import Any, Deque, TypeVar, Generic, Optional
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
@@ -15,7 +15,7 @@ class Queue(Generic[_T]):
|
||||
not_full: Any
|
||||
all_tasks_done: Any
|
||||
unfinished_tasks: Any
|
||||
queue: deque # undocumented
|
||||
queue: Deque[Any] # undocumented
|
||||
def __init__(self, maxsize: int = ...) -> None: ...
|
||||
def task_done(self) -> None: ...
|
||||
def join(self) -> None: ...
|
||||
@@ -27,5 +27,5 @@ class Queue(Generic[_T]):
|
||||
def get(self, block: bool = ..., timeout: Optional[float] = ...) -> _T: ...
|
||||
def get_nowait(self) -> _T: ...
|
||||
|
||||
class PriorityQueue(Queue): ...
|
||||
class LifoQueue(Queue): ...
|
||||
class PriorityQueue(Queue[_T]): ...
|
||||
class LifoQueue(Queue[_T]): ...
|
||||
|
||||
@@ -9,7 +9,7 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
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 list_directory(self, path: Union[str, unicode]) -> Optional[StringIO[Any]]: ...
|
||||
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: ...
|
||||
|
||||
+11
-11
@@ -1,22 +1,22 @@
|
||||
# NB: SocketServer.pyi and socketserver.pyi must remain consistent!
|
||||
# Stubs for socketserver
|
||||
|
||||
from typing import Any, BinaryIO, Optional, Tuple, Type
|
||||
from typing import Any, BinaryIO, Callable, Optional, Tuple, Type, Text, Union
|
||||
from socket import SocketType
|
||||
import sys
|
||||
import types
|
||||
|
||||
class BaseServer:
|
||||
address_family: int
|
||||
RequestHandlerClass: type
|
||||
RequestHandlerClass: Callable[..., BaseRequestHandler]
|
||||
server_address: Tuple[str, int]
|
||||
socket: SocketType
|
||||
allow_reuse_address: bool
|
||||
request_queue_size: int
|
||||
socket_type: int
|
||||
timeout: Optional[float]
|
||||
def __init__(self, server_address: Tuple[str, int],
|
||||
RequestHandlerClass: type) -> None: ...
|
||||
def __init__(self, server_address: Any,
|
||||
RequestHandlerClass: Callable[..., BaseRequestHandler]) -> None: ...
|
||||
def fileno(self) -> int: ...
|
||||
def handle_request(self) -> None: ...
|
||||
def serve_forever(self, poll_interval: float = ...) -> None: ...
|
||||
@@ -38,29 +38,29 @@ class BaseServer:
|
||||
def __enter__(self) -> BaseServer: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]],
|
||||
exc_val: Optional[BaseException],
|
||||
exc_tb: Optional[types.TracebackType]) -> bool: ...
|
||||
exc_tb: Optional[types.TracebackType]) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def service_actions(self) -> None: ...
|
||||
|
||||
class TCPServer(BaseServer):
|
||||
def __init__(self, server_address: Tuple[str, int],
|
||||
RequestHandlerClass: type,
|
||||
RequestHandlerClass: Callable[..., BaseRequestHandler],
|
||||
bind_and_activate: bool = ...) -> None: ...
|
||||
|
||||
class UDPServer(BaseServer):
|
||||
def __init__(self, server_address: Tuple[str, int],
|
||||
RequestHandlerClass: type,
|
||||
RequestHandlerClass: Callable[..., BaseRequestHandler],
|
||||
bind_and_activate: bool = ...) -> None: ...
|
||||
|
||||
if sys.platform != 'win32':
|
||||
class UnixStreamServer(BaseServer):
|
||||
def __init__(self, server_address: Tuple[str, int],
|
||||
RequestHandlerClass: type,
|
||||
def __init__(self, server_address: Union[Text, bytes],
|
||||
RequestHandlerClass: Callable[..., BaseRequestHandler],
|
||||
bind_and_activate: bool = ...) -> None: ...
|
||||
|
||||
class UnixDatagramServer(BaseServer):
|
||||
def __init__(self, server_address: Tuple[str, int],
|
||||
RequestHandlerClass: type,
|
||||
def __init__(self, server_address: Union[Text, bytes],
|
||||
RequestHandlerClass: Callable[..., BaseRequestHandler],
|
||||
bind_and_activate: bool = ...) -> None: ...
|
||||
|
||||
class ForkingMixIn: ...
|
||||
|
||||
@@ -6,7 +6,7 @@ _VT = TypeVar('_VT')
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
data: Mapping[_KT, _VT]
|
||||
data: Dict[_KT, _VT]
|
||||
|
||||
def __init__(self, initialdata: Mapping[_KT, _VT] = ...) -> None: ...
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
from typing import Iterable, MutableSequence, TypeVar, Union, overload
|
||||
from typing import Iterable, MutableSequence, TypeVar, Union, overload, List
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_ULT = TypeVar("_ULT", bound=UserList)
|
||||
_S = TypeVar("_S")
|
||||
|
||||
class UserList(MutableSequence[_T]):
|
||||
data: List[_T]
|
||||
def insert(self, index: int, object: _T) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, i: int, o: _T) -> None: ...
|
||||
@@ -14,5 +15,5 @@ class UserList(MutableSequence[_T]):
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
@overload
|
||||
def __getitem__(self: _ULT, s: slice) -> _ULT: ...
|
||||
def __getitem__(self: _S, s: slice) -> _S: ...
|
||||
def sort(self) -> None: ...
|
||||
|
||||
@@ -62,7 +62,7 @@ class UserString(Sequence[UserString]):
|
||||
def upper(self: _UST) -> _UST: ...
|
||||
def zfill(self: _UST, width: int) -> _UST: ...
|
||||
|
||||
class MutableString(UserString, MutableSequence[MutableString]): # type: ignore
|
||||
class MutableString(UserString, MutableSequence[MutableString]):
|
||||
@overload
|
||||
def __getitem__(self: _MST, i: int) -> _MST: ...
|
||||
@overload
|
||||
|
||||
+87
-59
@@ -17,6 +17,11 @@ import sys
|
||||
if sys.version_info >= (3,):
|
||||
from typing import SupportsBytes, SupportsRound
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T_co = TypeVar('_T_co', covariant=True)
|
||||
_KT = TypeVar('_KT')
|
||||
@@ -29,6 +34,9 @@ _T4 = TypeVar('_T4')
|
||||
_T5 = TypeVar('_T5')
|
||||
_TT = TypeVar('_TT', bound='type')
|
||||
|
||||
class _SupportsIndex(Protocol):
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
class object:
|
||||
__doc__: Optional[str]
|
||||
__dict__: Dict[str, Any]
|
||||
@@ -53,30 +61,30 @@ class object:
|
||||
def __getattribute__(self, name: str) -> Any: ...
|
||||
def __delattr__(self, name: str) -> None: ...
|
||||
def __sizeof__(self) -> int: ...
|
||||
def __reduce__(self) -> tuple: ...
|
||||
def __reduce_ex__(self, protocol: int) -> tuple: ...
|
||||
def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ...
|
||||
def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ...
|
||||
if sys.version_info >= (3,):
|
||||
def __dir__(self) -> Iterable[str]: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def __init_subclass__(cls) -> None: ...
|
||||
|
||||
class staticmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable
|
||||
__func__: Callable[..., Any]
|
||||
if sys.version_info >= (3,):
|
||||
__isabstractmethod__: bool
|
||||
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __init__(self, f: Callable[..., Any]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
|
||||
|
||||
class classmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable
|
||||
__func__: Callable[..., Any]
|
||||
if sys.version_info >= (3,):
|
||||
__isabstractmethod__: bool
|
||||
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __init__(self, f: Callable[..., Any]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
|
||||
|
||||
class type(object):
|
||||
__base__: type
|
||||
@@ -129,10 +137,12 @@ class super(object):
|
||||
|
||||
class int:
|
||||
@overload
|
||||
def __init__(self, x: Union[Text, bytes, SupportsInt] = ...) -> None: ...
|
||||
def __init__(self, x: Union[Text, bytes, SupportsInt, _SupportsIndex] = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: Union[Text, bytes, bytearray], base: int) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def as_integer_ratio(self) -> Tuple[int, Literal[1]]: ...
|
||||
@property
|
||||
def real(self) -> int: ...
|
||||
@property
|
||||
@@ -168,7 +178,7 @@ class int:
|
||||
def __rtruediv__(self, x: int) -> float: ...
|
||||
def __rmod__(self, x: int) -> int: ...
|
||||
def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
|
||||
def __pow__(self, x: int) -> Any: ... # Return type can be int or float, depending on x.
|
||||
def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ... # Return type can be int or float, depending on x.
|
||||
def __rpow__(self, x: int) -> Any: ...
|
||||
def __and__(self, n: int) -> int: ...
|
||||
def __or__(self, n: int) -> int: ...
|
||||
@@ -183,7 +193,10 @@ class int:
|
||||
def __neg__(self) -> int: ...
|
||||
def __pos__(self) -> int: ...
|
||||
def __invert__(self) -> int: ...
|
||||
def __trunc__(self) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
def __ceil__(self) -> int: ...
|
||||
def __floor__(self) -> int: ...
|
||||
def __round__(self, ndigits: Optional[int] = ...) -> int: ...
|
||||
def __getnewargs__(self) -> Tuple[int]: ...
|
||||
|
||||
@@ -206,7 +219,7 @@ class int:
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
class float:
|
||||
def __init__(self, x: Union[SupportsFloat, Text, bytes, bytearray] = ...) -> None: ...
|
||||
def __init__(self, x: Union[SupportsFloat, _SupportsIndex, Text, bytes, bytearray] = ...) -> None: ...
|
||||
def as_integer_ratio(self) -> Tuple[int, int]: ...
|
||||
def hex(self) -> str: ...
|
||||
def is_integer(self) -> bool: ...
|
||||
@@ -240,11 +253,10 @@ class float:
|
||||
def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
|
||||
def __rpow__(self, x: float) -> float: ...
|
||||
def __getnewargs__(self) -> Tuple[float]: ...
|
||||
def __trunc__(self) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
@overload
|
||||
def __round__(self) -> int: ...
|
||||
@overload
|
||||
def __round__(self, ndigits: None) -> int: ...
|
||||
def __round__(self, ndigits: None = ...) -> int: ...
|
||||
@overload
|
||||
def __round__(self, ndigits: int) -> float: ...
|
||||
|
||||
@@ -269,11 +281,9 @@ class float:
|
||||
|
||||
class complex:
|
||||
@overload
|
||||
def __init__(self, re: float = ..., im: float = ...) -> None: ...
|
||||
def __init__(self, real: float = ..., imag: float = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, s: str) -> None: ...
|
||||
@overload
|
||||
def __init__(self, s: SupportsComplex) -> None: ...
|
||||
def __init__(self, real: Union[str, SupportsComplex, _SupportsIndex]) -> None: ...
|
||||
|
||||
@property
|
||||
def real(self) -> float: ...
|
||||
@@ -332,7 +342,7 @@ else:
|
||||
end: int = ...) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> unicode: ...
|
||||
def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
|
||||
def format(self, *args: Any, **kwargs: Any) -> unicode: ...
|
||||
def format(self, *args: object, **kwargs: object) -> unicode: ...
|
||||
def index(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
def isalpha(self) -> bool: ...
|
||||
@@ -421,7 +431,7 @@ class str(Sequence[str], _str_base):
|
||||
def endswith(self, suffix: Union[Text, Tuple[Text, ...]]) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> str: ...
|
||||
def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def format(self, *args: Any, **kwargs: Any) -> str: ...
|
||||
def format(self, *args: object, **kwargs: object) -> str: ...
|
||||
if sys.version_info >= (3,):
|
||||
def format_map(self, map: Mapping[str, Any]) -> str: ...
|
||||
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
@@ -667,6 +677,8 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ...
|
||||
def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> bytearray: ...
|
||||
if sys.version_info < (3,):
|
||||
def extend(self, iterable: Union[str, Iterable[int]]) -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
@@ -734,7 +746,7 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def __repr__(self) -> str: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
__hash__: None # type: ignore
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
@overload
|
||||
@@ -784,9 +796,10 @@ class memoryview(Sized, Container[_mv_container_type]):
|
||||
c_contiguous: bool
|
||||
f_contiguous: bool
|
||||
contiguous: bool
|
||||
nbytes: int
|
||||
def __init__(self, obj: Union[bytes, bytearray, memoryview]) -> None: ...
|
||||
def __enter__(self) -> memoryview: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
|
||||
else:
|
||||
def __init__(self, obj: Union[bytes, bytearray, buffer, memoryview]) -> None: ...
|
||||
|
||||
@@ -799,16 +812,19 @@ class memoryview(Sized, Container[_mv_container_type]):
|
||||
def __iter__(self) -> Iterator[_mv_container_type]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: memoryview) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, i: int, o: bytes) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: memoryview) -> None: ...
|
||||
|
||||
def tobytes(self) -> bytes: ...
|
||||
def tolist(self) -> List[int]: ...
|
||||
|
||||
if sys.version_info >= (3, 2):
|
||||
def release(self) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
def hex(self) -> str: ...
|
||||
|
||||
@@ -841,13 +857,14 @@ class bool(int):
|
||||
def __getnewargs__(self) -> Tuple[int]: ...
|
||||
|
||||
class slice(object):
|
||||
start: Optional[int]
|
||||
step: Optional[int]
|
||||
stop: Optional[int]
|
||||
start: Any
|
||||
step: Any
|
||||
stop: Any
|
||||
@overload
|
||||
def __init__(self, stop: Optional[int]) -> None: ...
|
||||
def __init__(self, stop: Any) -> None: ...
|
||||
@overload
|
||||
def __init__(self, start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> None: ...
|
||||
def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ...
|
||||
__hash__: None # type: ignore
|
||||
def indices(self, len: int) -> Tuple[int, int, int]: ...
|
||||
|
||||
class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
@@ -863,7 +880,10 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
def __le__(self, x: Tuple[_T_co, ...]) -> bool: ...
|
||||
def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ...
|
||||
def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ...
|
||||
@overload
|
||||
def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
|
||||
@overload
|
||||
def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ...
|
||||
def __mul__(self, n: int) -> Tuple[_T_co, ...]: ...
|
||||
def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ...
|
||||
def count(self, x: Any) -> int: ...
|
||||
@@ -876,9 +896,9 @@ class function:
|
||||
# TODO not defined in builtins!
|
||||
__name__: str
|
||||
__module__: str
|
||||
__code__: CodeType
|
||||
if sys.version_info >= (3,):
|
||||
__qualname__: str
|
||||
__code__: CodeType
|
||||
__annotations__: Dict[str, Any]
|
||||
|
||||
class list(MutableSequence[_T], Generic[_T]):
|
||||
@@ -905,7 +925,7 @@ class list(MutableSequence[_T], Generic[_T]):
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __hash__(self) -> int: ...
|
||||
__hash__: None # type: ignore
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
@overload
|
||||
@@ -978,7 +998,10 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __setitem__(self, k: _KT, v: _VT) -> None: ...
|
||||
def __delitem__(self, v: _KT) -> None: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def __reversed__(self) -> Iterator[_KT]: ...
|
||||
def __str__(self) -> str: ...
|
||||
__hash__: None # type: ignore
|
||||
|
||||
class set(MutableSet[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
|
||||
@@ -1015,6 +1038,7 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
def __lt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __gt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
__hash__: None # type: ignore
|
||||
|
||||
class frozenset(AbstractSet[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
|
||||
@@ -1106,8 +1130,6 @@ if sys.version_info < (3,):
|
||||
if sys.version_info >= (3,):
|
||||
def ascii(__o: object) -> str: ...
|
||||
|
||||
class _SupportsIndex(Protocol):
|
||||
def __index__(self) -> int: ...
|
||||
def bin(__number: Union[int, _SupportsIndex]) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
@@ -1124,7 +1146,7 @@ if sys.version_info >= (3, 6):
|
||||
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
|
||||
class _PathLike(Generic[AnyStr]):
|
||||
def __fspath__(self) -> AnyStr: ...
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike[Any]], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
else:
|
||||
@@ -1149,20 +1171,15 @@ if sys.version_info >= (3,):
|
||||
def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
else:
|
||||
@overload
|
||||
def filter(__function: Callable[[AnyStr], Any], # type: ignore
|
||||
__iterable: AnyStr) -> AnyStr: ...
|
||||
def filter(__function: Callable[[AnyStr], Any], __iterable: AnyStr) -> AnyStr: ... # type: ignore
|
||||
@overload
|
||||
def filter(__function: None, # type: ignore
|
||||
__iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ...
|
||||
def filter(__function: None, __iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ... # type: ignore
|
||||
@overload
|
||||
def filter(__function: Callable[[_T], Any], # type: ignore
|
||||
__iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ...
|
||||
def filter(__function: Callable[[_T], Any], __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... # type: ignore
|
||||
@overload
|
||||
def filter(__function: None,
|
||||
__iterable: Iterable[Optional[_T]]) -> List[_T]: ...
|
||||
def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> List[_T]: ...
|
||||
@overload
|
||||
def filter(__function: Callable[[_T], Any],
|
||||
__iterable: Iterable[_T]) -> List[_T]: ...
|
||||
def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ...
|
||||
def format(__o: object, __format_spec: str = ...) -> str: ... # TODO unicode
|
||||
def getattr(__o: Any, name: Text, __default: Any = ...) -> Any: ...
|
||||
def globals() -> Dict[str, Any]: ...
|
||||
@@ -1180,9 +1197,11 @@ else:
|
||||
@overload
|
||||
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ...
|
||||
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def iter(__function: Callable[[], Optional[_T]], __sentinel: None) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ...
|
||||
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
|
||||
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
|
||||
def len(__o: Sized) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
def license() -> None: ...
|
||||
@@ -1318,7 +1337,7 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
|
||||
def oct(__i: Union[int, _SupportsIndex]) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
|
||||
def open(file: Union[str, bytes, int, _PathLike[Any]], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...,
|
||||
opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ...
|
||||
elif sys.version_info >= (3,):
|
||||
@@ -1332,12 +1351,16 @@ def ord(__c: Union[Text, bytes]) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
class _Writer(Protocol):
|
||||
def write(self, __s: str) -> Any: ...
|
||||
def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ..., flush: bool = ...) -> None: ...
|
||||
def print(
|
||||
*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ..., flush: bool = ...
|
||||
) -> None: ...
|
||||
|
||||
else:
|
||||
class _Writer(Protocol):
|
||||
def write(self, __s: Any) -> Any: ...
|
||||
# This is only available after from __future__ import print_function.
|
||||
def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ...) -> None: ...
|
||||
def print(*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ...) -> None: ...
|
||||
|
||||
@overload
|
||||
def pow(__x: int, __y: int) -> Any: ... # The return type can be int or float, depending on y
|
||||
@overload
|
||||
@@ -1370,7 +1393,7 @@ if sys.version_info >= (3,):
|
||||
@overload
|
||||
def round(number: SupportsRound[_T]) -> int: ...
|
||||
@overload
|
||||
def round(number: SupportsRound[_T], ndigits: None) -> int: ... # type: ignore
|
||||
def round(number: SupportsRound[_T], ndigits: None) -> int: ...
|
||||
@overload
|
||||
def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
|
||||
else:
|
||||
@@ -1390,7 +1413,7 @@ if sys.version_info >= (3,):
|
||||
else:
|
||||
def sorted(__iterable: Iterable[_T], *,
|
||||
cmp: Callable[[_T, _T], int] = ...,
|
||||
key: Callable[[_T], Any] = ...,
|
||||
key: Optional[Callable[[_T], Any]] = ...,
|
||||
reverse: bool = ...) -> List[_T]: ...
|
||||
@overload
|
||||
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
|
||||
@@ -1436,8 +1459,10 @@ else:
|
||||
def zip(__iter1: Iterable[Any], __iter2: Iterable[Any], __iter3: Iterable[Any],
|
||||
__iter4: Iterable[Any], __iter5: Iterable[Any], __iter6: Iterable[Any],
|
||||
*iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ...
|
||||
def __import__(name: Text, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...,
|
||||
fromlist: List[str] = ..., level: int = ...) -> Any: ...
|
||||
def __import__(name: Text, globals: Optional[Mapping[str, Any]] = ...,
|
||||
locals: Optional[Mapping[str, Any]] = ...,
|
||||
fromlist: Sequence[str] = ...,
|
||||
level: int = ...) -> Any: ...
|
||||
|
||||
# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
|
||||
# not exposed anywhere under that name, we make it private here.
|
||||
@@ -1467,6 +1492,8 @@ class BaseException(object):
|
||||
__suppress_context__: bool
|
||||
__traceback__: Optional[TracebackType]
|
||||
def __init__(self, *args: object) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __repr__(self) -> str: ...
|
||||
if sys.version_info < (3,):
|
||||
def __getitem__(self, i: int) -> Any: ...
|
||||
def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ...
|
||||
@@ -1508,9 +1535,10 @@ class AttributeError(_StandardError): ...
|
||||
class BufferError(_StandardError): ...
|
||||
class EOFError(_StandardError): ...
|
||||
class ImportError(_StandardError):
|
||||
if sys.version_info >= (3,):
|
||||
name: str
|
||||
path: str
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, *args, name: Optional[str] = ..., path: Optional[str] = ...) -> None: ...
|
||||
name: Optional[str]
|
||||
path: Optional[str]
|
||||
class LookupError(_StandardError): ...
|
||||
class MemoryError(_StandardError): ...
|
||||
class NameError(_StandardError): ...
|
||||
@@ -1523,7 +1551,7 @@ class SyntaxError(_StandardError):
|
||||
msg: str
|
||||
lineno: int
|
||||
offset: Optional[int]
|
||||
text: str
|
||||
text: Optional[str]
|
||||
filename: str
|
||||
class SystemError(_StandardError): ...
|
||||
class TypeError(_StandardError): ...
|
||||
@@ -1612,7 +1640,7 @@ if sys.version_info < (3,):
|
||||
def next(self) -> str: ...
|
||||
def read(self, n: int = ...) -> str: ...
|
||||
def __enter__(self) -> BinaryIO: ...
|
||||
def __exit__(self, t: Optional[type] = ..., exc: Optional[BaseException] = ..., tb: Optional[Any] = ...) -> bool: ...
|
||||
def __exit__(self, t: Optional[type] = ..., exc: Optional[BaseException] = ..., tb: Optional[Any] = ...) -> Optional[bool]: ...
|
||||
def flush(self) -> None: ...
|
||||
def fileno(self) -> int: ...
|
||||
def isatty(self) -> bool: ...
|
||||
|
||||
+14
-17
@@ -1,18 +1,19 @@
|
||||
"""Stub file for the '_collections' module."""
|
||||
|
||||
from typing import Any, Generic, Iterator, TypeVar, Optional, Union
|
||||
|
||||
class defaultdict(dict):
|
||||
default_factory: None
|
||||
def __init__(self, default: Any = ..., init: Any = ...) -> None: ...
|
||||
def __missing__(self, key) -> Any:
|
||||
raise KeyError()
|
||||
def __copy__(self) -> defaultdict: ...
|
||||
def copy(self) -> defaultdict: ...
|
||||
from typing import Any, Callable, Dict, Generic, Iterator, TypeVar, Optional, Union
|
||||
|
||||
_K = TypeVar("_K")
|
||||
_V = TypeVar("_V")
|
||||
_T = TypeVar('_T')
|
||||
_T2 = TypeVar('_T2')
|
||||
|
||||
class defaultdict(Dict[_K, _V]):
|
||||
default_factory: None
|
||||
def __init__(self, __default_factory: Callable[[], _V] = ..., init: Any = ...) -> None: ...
|
||||
def __missing__(self, key: _K) -> _V: ...
|
||||
def __copy__(self: _T) -> _T: ...
|
||||
def copy(self: _T) -> _T: ...
|
||||
|
||||
class deque(Generic[_T]):
|
||||
maxlen: Optional[int]
|
||||
def __init__(self, iterable: Iterator[_T] = ..., maxlen: int = ...) -> None: ...
|
||||
@@ -22,18 +23,14 @@ class deque(Generic[_T]):
|
||||
def count(self, x: Any) -> int: ...
|
||||
def extend(self, iterable: Iterator[_T]) -> None: ...
|
||||
def extendleft(self, iterable: Iterator[_T]) -> None: ...
|
||||
def pop(self) -> _T:
|
||||
raise IndexError()
|
||||
def popleft(self) -> _T:
|
||||
raise IndexError()
|
||||
def remove(self, value: _T) -> None:
|
||||
raise IndexError()
|
||||
def pop(self) -> _T: ...
|
||||
def popleft(self) -> _T: ...
|
||||
def remove(self, value: _T) -> None: ...
|
||||
def reverse(self) -> None: ...
|
||||
def rotate(self, n: int = ...) -> None: ...
|
||||
def __contains__(self, o: Any) -> bool: ...
|
||||
def __copy__(self) -> deque[_T]: ...
|
||||
def __getitem__(self, i: int) -> _T:
|
||||
raise IndexError()
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
def __iadd__(self, other: deque[_T2]) -> deque[Union[_T, _T2]]: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
+6
-73
@@ -3,10 +3,6 @@
|
||||
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Tuple, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_T2 = TypeVar("_T2")
|
||||
_T3 = TypeVar("_T3")
|
||||
_T4 = TypeVar("_T4")
|
||||
_T5 = TypeVar("_T5")
|
||||
_S = TypeVar("_S")
|
||||
|
||||
@overload
|
||||
@@ -16,72 +12,9 @@ def reduce(function: Callable[[_T, _T], _T],
|
||||
def reduce(function: Callable[[_T, _S], _T],
|
||||
sequence: Iterable[_S], initial: _T) -> _T: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[[_T], _S], __arg: _T) -> Callable[[], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2], _S], __arg: _T) -> Callable[[_T2], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3], _S], __arg: _T) -> Callable[[_T2, _T3], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg: _T) -> Callable[[_T2, _T3, _T4], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg: _T) -> Callable[[_T2, _T3, _T4, _T5], _S]: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2) -> Callable[[], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2) -> Callable[[_T3], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2) -> Callable[[_T3, _T4], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2) -> Callable[[_T3, _T4, _T5], _S]: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3) -> Callable[[], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3) -> Callable[[_T4], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3) -> Callable[[_T4, _T5], _S]: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3,
|
||||
__arg4: _T4) -> Callable[[], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3,
|
||||
__arg4: _T4) -> Callable[[_T5], _S]: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3,
|
||||
__arg4: _T4,
|
||||
__arg5: _T5) -> Callable[[], _S]: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[..., _S],
|
||||
*args: Any,
|
||||
**kwargs: Any) -> Callable[..., _S]: ...
|
||||
class partial(object):
|
||||
func: Callable[..., Any]
|
||||
args: Tuple[Any, ...]
|
||||
keywords: Dict[str, Any]
|
||||
def __init__(self, func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
+6
-16
@@ -6,29 +6,19 @@
|
||||
from typing import Any, List, Tuple, Dict, Generic
|
||||
|
||||
def coverage(a: str) -> Any: ...
|
||||
|
||||
def logreader(a: str) -> LogReaderType:
|
||||
raise IOError()
|
||||
raise RuntimeError()
|
||||
|
||||
def profiler(a: str, *args, **kwargs) -> Any:
|
||||
raise IOError()
|
||||
|
||||
def resolution() -> tuple: ...
|
||||
|
||||
def logreader(a: str) -> LogReaderType: ...
|
||||
def profiler(a: str, *args, **kwargs) -> Any: ...
|
||||
def resolution() -> Tuple[Any, ...]: ...
|
||||
|
||||
class LogReaderType(object):
|
||||
def close(self) -> None: ...
|
||||
def fileno(self) -> int:
|
||||
raise ValueError()
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
class ProfilerType(object):
|
||||
def addinfo(self, a: str, b: str) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def fileno(self) -> int:
|
||||
raise ValueError()
|
||||
def fileno(self) -> int: ...
|
||||
def runcall(self, *args, **kwargs) -> Any: ...
|
||||
def runcode(self, a, b, *args, **kwargs) -> Any:
|
||||
raise TypeError()
|
||||
def runcode(self, a, b, *args, **kwargs) -> Any: ...
|
||||
def start(self) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
|
||||
+17
-14
@@ -16,7 +16,7 @@ _T = TypeVar("_T")
|
||||
class _IOBase(BinaryIO):
|
||||
@property
|
||||
def closed(self) -> bool: ...
|
||||
def _checkClosed(self) -> None: ...
|
||||
def _checkClosed(self, msg: Optional[str] = ...) -> None: ... # undocumented
|
||||
def _checkReadable(self) -> None: ...
|
||||
def _checkSeekable(self) -> None: ...
|
||||
def _checkWritable(self) -> None: ...
|
||||
@@ -32,7 +32,7 @@ class _IOBase(BinaryIO):
|
||||
def truncate(self, size: Optional[int] = ...) -> int: ...
|
||||
def writable(self) -> bool: ...
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> bool: ...
|
||||
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> Optional[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: ...
|
||||
@@ -84,8 +84,8 @@ class BufferedWriter(_BufferedIOBase):
|
||||
|
||||
class BytesIO(_BufferedIOBase):
|
||||
def __init__(self, initial_bytes: bytes = ...) -> None: ...
|
||||
def __setstate__(self, tuple) -> None: ...
|
||||
def __getstate__(self) -> tuple: ...
|
||||
def __setstate__(self, state: Tuple[Any, ...]) -> None: ...
|
||||
def __getstate__(self) -> Tuple[Any, ...]: ...
|
||||
# BytesIO does not contain a "name" field. This workaround is necessary
|
||||
# to allow BytesIO sub-classes to add this field, as it is defined
|
||||
# as a read-only property on IO[].
|
||||
@@ -129,7 +129,7 @@ class _TextIOBase(TextIO):
|
||||
def _checkSeekable(self) -> None: ...
|
||||
def _checkWritable(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def detach(self) -> IO: ...
|
||||
def detach(self) -> IO[Any]: ...
|
||||
def fileno(self) -> int: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
@@ -146,7 +146,7 @@ class _TextIOBase(TextIO):
|
||||
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 __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> Optional[bool]: ...
|
||||
def __iter__(self: _T) -> _T: ...
|
||||
|
||||
class StringIO(_TextIOBase):
|
||||
@@ -154,8 +154,8 @@ class StringIO(_TextIOBase):
|
||||
def __init__(self,
|
||||
initial_value: Optional[unicode] = ...,
|
||||
newline: Optional[unicode] = ...) -> None: ...
|
||||
def __setstate__(self, state: tuple) -> None: ...
|
||||
def __getstate__(self) -> tuple: ...
|
||||
def __setstate__(self, state: Tuple[Any, ...]) -> None: ...
|
||||
def __getstate__(self) -> Tuple[Any, ...]: ...
|
||||
# StringIO does not contain a "name" field. This workaround is necessary
|
||||
# to allow StringIO sub-classes to add this field, as it is defined
|
||||
# as a read-only property on IO[].
|
||||
@@ -167,12 +167,15 @@ class TextIOWrapper(_TextIOBase):
|
||||
line_buffering: bool
|
||||
buffer: BinaryIO
|
||||
_CHUNK_SIZE: int
|
||||
def __init__(self, buffer: IO,
|
||||
encoding: Optional[Text] = ...,
|
||||
errors: Optional[Text] = ...,
|
||||
newline: Optional[Text] = ...,
|
||||
line_buffering: bool = ...,
|
||||
write_through: bool = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
buffer: IO[Any],
|
||||
encoding: Optional[Text] = ...,
|
||||
errors: Optional[Text] = ...,
|
||||
newline: Optional[Text] = ...,
|
||||
line_buffering: bool = ...,
|
||||
write_through: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
def open(file: Union[str, unicode, int],
|
||||
mode: Text = ...,
|
||||
|
||||
+3
-13
@@ -1,17 +1,7 @@
|
||||
"""Stub file for the '_json' module."""
|
||||
# This is an autogenerated file. It serves as a starting point
|
||||
# for a more precise manual annotation of this module.
|
||||
# Feel free to edit the source below, but remove this header when you do.
|
||||
|
||||
from typing import Any, List, Tuple, Dict, Generic
|
||||
|
||||
def encode_basestring_ascii(*args, **kwargs) -> str:
|
||||
raise TypeError()
|
||||
|
||||
def scanstring(a, b, *args, **kwargs) -> tuple:
|
||||
raise TypeError()
|
||||
from typing import Any, List, Tuple, Dict, Generic, Tuple
|
||||
|
||||
def encode_basestring_ascii(*args, **kwargs) -> str: ...
|
||||
def scanstring(a, b, *args, **kwargs) -> Tuple[Any, ...]: ...
|
||||
|
||||
class Encoder(object): ...
|
||||
|
||||
class Scanner(object): ...
|
||||
|
||||
+10
-14
@@ -253,34 +253,30 @@ class SocketType(object):
|
||||
timeout: float
|
||||
|
||||
def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ...
|
||||
def accept(self) -> Tuple[SocketType, tuple]: ...
|
||||
def bind(self, address: tuple) -> None: ...
|
||||
def accept(self) -> Tuple[SocketType, Tuple[Any, ...]]: ...
|
||||
def bind(self, address: Tuple[Any, ...]) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def connect(self, address: tuple) -> None:
|
||||
raise gaierror
|
||||
raise timeout
|
||||
def connect_ex(self, address: tuple) -> int: ...
|
||||
def connect(self, address: Tuple[Any, ...]) -> None: ...
|
||||
def connect_ex(self, address: Tuple[Any, ...]) -> int: ...
|
||||
def dup(self) -> SocketType: ...
|
||||
def fileno(self) -> int: ...
|
||||
def getpeername(self) -> tuple: ...
|
||||
def getsockname(self) -> tuple: ...
|
||||
def getpeername(self) -> Tuple[Any, ...]: ...
|
||||
def getsockname(self) -> Tuple[Any, ...]: ...
|
||||
def getsockopt(self, level: int, option: int, buffersize: int = ...) -> str: ...
|
||||
def gettimeout(self) -> float: ...
|
||||
def listen(self, backlog: int) -> None:
|
||||
raise error
|
||||
def listen(self, backlog: int) -> None: ...
|
||||
def makefile(self, mode: str = ..., buffersize: int = ...) -> IO[Any]: ...
|
||||
def recv(self, buffersize: int, flags: int = ...) -> str: ...
|
||||
def recv_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ...
|
||||
def recvfrom(self, buffersize: int, flags: int = ...) -> tuple:
|
||||
raise error
|
||||
def recvfrom(self, buffersize: int, flags: int = ...) -> Tuple[Any, ...]: ...
|
||||
def recvfrom_into(self, buffer: bytearray, nbytes: int = ...,
|
||||
flags: int = ...) -> int: ...
|
||||
def send(self, data: str, flags: int = ...) -> int: ...
|
||||
def sendall(self, data: str, flags: int = ...) -> None: ...
|
||||
@overload
|
||||
def sendto(self, data: str, address: tuple) -> int: ...
|
||||
def sendto(self, data: str, address: Tuple[Any, ...]) -> int: ...
|
||||
@overload
|
||||
def sendto(self, data: str, flags: int, address: tuple) -> int: ...
|
||||
def sendto(self, data: str, flags: int, address: Tuple[Any, ...]) -> int: ...
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
def setsockopt(self, level: int, option: int, value: Union[int, str]) -> None: ...
|
||||
def settimeout(self, value: Optional[float]) -> None: ...
|
||||
|
||||
+17
-15
@@ -8,10 +8,8 @@ MAXREPEAT: long
|
||||
copyright: str
|
||||
|
||||
class SRE_Match(object):
|
||||
def start(self, group: int = ...) -> int:
|
||||
raise IndexError()
|
||||
def end(self, group: int = ...) -> int:
|
||||
raise IndexError()
|
||||
def start(self, group: int = ...) -> int: ...
|
||||
def end(self, group: int = ...) -> int: ...
|
||||
def expand(self, s: str) -> Any: ...
|
||||
@overload
|
||||
def group(self) -> str: ...
|
||||
@@ -19,8 +17,9 @@ class SRE_Match(object):
|
||||
def group(self, group: int = ...) -> Optional[str]: ...
|
||||
def groupdict(self) -> Dict[int, Optional[str]]: ...
|
||||
def groups(self) -> Tuple[Optional[str], ...]: ...
|
||||
def span(self) -> Tuple[int, int]:
|
||||
raise IndexError()
|
||||
def span(self) -> Tuple[int, int]: ...
|
||||
@property
|
||||
def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented
|
||||
|
||||
class SRE_Scanner(object):
|
||||
pattern: str
|
||||
@@ -33,20 +32,23 @@ class SRE_Pattern(object):
|
||||
groups: int
|
||||
groupindex: Mapping[str, int]
|
||||
indexgroup: Sequence[int]
|
||||
def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Union[tuple, str]]: ...
|
||||
def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Union[tuple, str]]: ...
|
||||
def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Union[Tuple[Any, ...], str]]: ...
|
||||
def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Union[Tuple[Any, ...], str]]: ...
|
||||
def match(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
|
||||
def scanner(self, s: str, start: int = ..., end: int = ...) -> SRE_Scanner: ...
|
||||
def search(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
|
||||
def split(self, source: str, maxsplit: int = ...) -> List[Optional[str]]: ...
|
||||
def sub(self, repl: str, string: str, count: int = ...) -> tuple: ...
|
||||
def subn(self, repl: str, string: str, count: int = ...) -> tuple: ...
|
||||
def sub(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...
|
||||
def subn(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...
|
||||
|
||||
def compile(pattern: str, flags: int, code: List[int],
|
||||
groups: int = ...,
|
||||
groupindex: Mapping[str, int] = ...,
|
||||
indexgroup: Sequence[int] = ...) -> SRE_Pattern:
|
||||
raise OverflowError()
|
||||
def compile(
|
||||
pattern: str,
|
||||
flags: int,
|
||||
code: List[int],
|
||||
groups: int = ...,
|
||||
groupindex: Mapping[str, int] = ...,
|
||||
indexgroup: Sequence[int] = ...,
|
||||
) -> SRE_Pattern: ...
|
||||
|
||||
def getcodesize() -> int: ...
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# Source: https://hg.python.org/cpython/file/2.7/Lib/_threading_local.py
|
||||
from typing import Any, List
|
||||
|
||||
__all__: List[str]
|
||||
from typing import Any
|
||||
|
||||
class _localbase(object): ...
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
from typing import Any, List, Optional, Type
|
||||
|
||||
default_action: str
|
||||
filters: List[tuple]
|
||||
once_registry: dict
|
||||
|
||||
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: ...
|
||||
+7
-5
@@ -1,18 +1,20 @@
|
||||
from typing import Any, Dict, Set, Tuple, Type
|
||||
from typing import Any, Callable, Dict, Set, Tuple, Type, TypeVar
|
||||
import _weakrefset
|
||||
|
||||
_FuncT = TypeVar('_FuncT', bound=Callable[..., Any])
|
||||
|
||||
# NOTE: mypy has special processing for ABCMeta and abstractmethod.
|
||||
|
||||
def abstractmethod(funcobj: Any) -> Any: ...
|
||||
def abstractmethod(funcobj: _FuncT) -> _FuncT: ...
|
||||
|
||||
class ABCMeta(type):
|
||||
# TODO: FrozenSet
|
||||
__abstractmethods__: Set[Any]
|
||||
_abc_cache: _weakrefset.WeakSet
|
||||
_abc_cache: _weakrefset.WeakSet[Any]
|
||||
_abc_invalidation_counter: int
|
||||
_abc_negative_cache: _weakrefset.WeakSet
|
||||
_abc_negative_cache: _weakrefset.WeakSet[Any]
|
||||
_abc_negative_cache_version: int
|
||||
_abc_registry: _weakrefset.WeakSet
|
||||
_abc_registry: _weakrefset.WeakSet[Any]
|
||||
def __init__(self, name: str, bases: Tuple[type, ...], namespace: Dict[Any, Any]) -> None: ...
|
||||
def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ...
|
||||
def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# These are not exported.
|
||||
from typing import Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible
|
||||
from typing import Any, Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible
|
||||
|
||||
# These are exported.
|
||||
from typing import (
|
||||
@@ -28,7 +28,7 @@ _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[Union[str, unicode]]],
|
||||
verbose: bool = ..., rename: bool = ...) -> Type[tuple]: ...
|
||||
verbose: bool = ..., rename: bool = ...) -> Type[Tuple[Any, ...]]: ...
|
||||
|
||||
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ...,
|
||||
@@ -56,8 +56,6 @@ class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
|
||||
def __reversed__(self) -> Iterator[_T]: ...
|
||||
def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ...
|
||||
|
||||
_CounterT = TypeVar('_CounterT', bound=Counter)
|
||||
|
||||
class Counter(Dict[_T, int], Generic[_T]):
|
||||
@overload
|
||||
def __init__(self, **kwargs: int) -> None: ...
|
||||
@@ -65,7 +63,7 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
def __init__(self, mapping: Mapping[_T, int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
def copy(self: _CounterT) -> _CounterT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
def elements(self) -> Iterator[_T]: ...
|
||||
def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ...
|
||||
@overload
|
||||
@@ -93,15 +91,11 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
def __iand__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __ior__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
|
||||
_OrderedDictT = TypeVar('_OrderedDictT', bound=OrderedDict)
|
||||
|
||||
class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
|
||||
def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ...
|
||||
def copy(self: _OrderedDictT) -> _OrderedDictT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
def __reversed__(self) -> Iterator[_KT]: ...
|
||||
|
||||
_DefaultDictT = TypeVar('_DefaultDictT', bound=defaultdict)
|
||||
|
||||
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
default_factory: Callable[[], _VT]
|
||||
@overload
|
||||
@@ -123,4 +117,4 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __init__(self, default_factory: Optional[Callable[[], _VT]],
|
||||
iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
|
||||
def __missing__(self, key: _KT) -> _VT: ...
|
||||
def copy(self: _DefaultDictT) -> _DefaultDictT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
|
||||
+12
-3
@@ -1,10 +1,19 @@
|
||||
# Stubs for compileall (Python 2)
|
||||
|
||||
from typing import Optional, Pattern, Union
|
||||
from typing import Any, Optional, Pattern, Union
|
||||
|
||||
_Path = Union[str, bytes]
|
||||
|
||||
# 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_dir(
|
||||
dir: _Path,
|
||||
maxlevels: int = ...,
|
||||
ddir: Optional[_Path] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
) -> int: ...
|
||||
def compile_file(
|
||||
fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...,
|
||||
) -> int: ...
|
||||
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ...
|
||||
|
||||
@@ -105,6 +105,8 @@ class FileCookieJar(CookieJar):
|
||||
def load(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
|
||||
def revert(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
|
||||
|
||||
class LWPCookieJar(FileCookieJar):
|
||||
def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented
|
||||
|
||||
MozillaCookieJar = FileCookieJar
|
||||
LWPCookieJar = FileCookieJar
|
||||
def lwp_cookie_str(cookie: Cookie) -> str: ...
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
from typing import TypeVar, Callable, Union, Tuple, Any, Optional, SupportsInt, Hashable, List
|
||||
|
||||
|
||||
_Type = TypeVar("_Type", bound=type)
|
||||
_Reduce = Union[Tuple[Callable[..., _Type], Tuple[Any, ...]], Tuple[Callable[..., _Type], Tuple[Any, ...], Optional[Any]]]
|
||||
|
||||
__all__: List[str]
|
||||
|
||||
def pickle(ob_type: _Type, pickle_function: Callable[[_Type], Union[str, _Reduce[_Type]]], constructor_ob: Optional[Callable[[_Reduce[_Type]], _Type]] = ...) -> None: ...
|
||||
def constructor(object: Callable[[_Reduce[_Type]], _Type]) -> None: ...
|
||||
def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ...
|
||||
def remove_extension(module: Hashable, name: Hashable, code: int) -> None: ...
|
||||
def clear_extension_cache() -> None: ...
|
||||
@@ -1,5 +1,5 @@
|
||||
from typing import Generator
|
||||
from typing import Any, Generator
|
||||
|
||||
def walk(self) -> Generator: ...
|
||||
def body_line_iterator(msg, decode: bool = ...) -> Generator: ...
|
||||
def typed_subpart_iterator(msg, maintype=..., subtype=...) -> Generator: ...
|
||||
def walk(self) -> Generator[Any, Any, Any]: ...
|
||||
def body_line_iterator(msg, decode: bool = ...) -> Generator[Any, Any, Any]: ...
|
||||
def typed_subpart_iterator(msg, maintype=..., subtype=...) -> Generator[Any, Any, Any]: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Generator
|
||||
from typing import Any, Generator
|
||||
|
||||
class Message:
|
||||
preamble = ...
|
||||
@@ -42,4 +42,4 @@ class Message:
|
||||
def set_boundary(self, boundary) -> None: ...
|
||||
def get_content_charset(self, failobj=...): ...
|
||||
def get_charsets(self, failobj=...): ...
|
||||
def walk(self) -> Generator: ...
|
||||
def walk(self) -> Generator[Any, Any, Any]: ...
|
||||
|
||||
+6
-74
@@ -4,15 +4,10 @@
|
||||
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Any, Callable, Generic, Dict, Iterable, Optional, Sequence, Tuple, TypeVar, overload
|
||||
from collections import namedtuple
|
||||
|
||||
_AnyCallable = Callable[..., Any]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_T2 = TypeVar("_T2")
|
||||
_T3 = TypeVar("_T3")
|
||||
_T4 = TypeVar("_T4")
|
||||
_T5 = TypeVar("_T5")
|
||||
_S = TypeVar("_S")
|
||||
@overload
|
||||
def reduce(function: Callable[[_T, _T], _T],
|
||||
@@ -30,72 +25,9 @@ def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequenc
|
||||
def total_ordering(cls: type) -> type: ...
|
||||
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[[_T], _S], __arg: _T) -> Callable[[], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2], _S], __arg: _T) -> Callable[[_T2], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3], _S], __arg: _T) -> Callable[[_T2, _T3], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg: _T) -> Callable[[_T2, _T3, _T4], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg: _T) -> Callable[[_T2, _T3, _T4, _T5], _S]: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2) -> Callable[[], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2) -> Callable[[_T3], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2) -> Callable[[_T3, _T4], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2) -> Callable[[_T3, _T4, _T5], _S]: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3) -> Callable[[], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3) -> Callable[[_T4], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3) -> Callable[[_T4, _T5], _S]: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3,
|
||||
__arg4: _T4) -> Callable[[], _S]: ...
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3,
|
||||
__arg4: _T4) -> Callable[[_T5], _S]: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
|
||||
__arg1: _T,
|
||||
__arg2: _T2,
|
||||
__arg3: _T3,
|
||||
__arg4: _T4,
|
||||
__arg5: _T5) -> Callable[[], _S]: ...
|
||||
|
||||
@overload
|
||||
def partial(__func: Callable[..., _S],
|
||||
*args: Any,
|
||||
**kwargs: Any) -> Callable[..., _S]: ...
|
||||
class partial(Generic[_T]):
|
||||
func = ... # Callable[..., _T]
|
||||
args: Tuple[Any, ...]
|
||||
keywords: Dict[str, Any]
|
||||
def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
|
||||
|
||||
@@ -6,9 +6,9 @@ _DataType = Union[str, unicode, bytearray, buffer, memoryview]
|
||||
|
||||
class _hash(object): # This is not actually in the module namespace.
|
||||
name: str
|
||||
block_size = 0
|
||||
digest_size = 0
|
||||
digestsize = 0
|
||||
block_size: int
|
||||
digest_size: int
|
||||
digestsize: int
|
||||
def __init__(self, arg: _DataType = ...) -> None: ...
|
||||
def update(self, arg: _DataType) -> None: ...
|
||||
def digest(self) -> str: ...
|
||||
|
||||
+9
-7
@@ -1,16 +1,18 @@
|
||||
from typing import TypeVar, List, Iterable, Any, Callable, Optional
|
||||
from typing import TypeVar, List, Iterable, Any, Callable, Optional, Protocol
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class _Sortable(Protocol):
|
||||
def __lt__(self: _T, other: _T) -> bool: ...
|
||||
|
||||
def cmp_lt(x, y) -> bool: ...
|
||||
def heappush(heap: List[_T], item: _T) -> None: ...
|
||||
def heappop(heap: List[_T]) -> _T:
|
||||
raise IndexError() # if heap is empty
|
||||
def heappop(heap: List[_T]) -> _T: ...
|
||||
def heappushpop(heap: List[_T], item: _T) -> _T: ...
|
||||
def heapify(x: List[_T]) -> None: ...
|
||||
def heapreplace(heap: List[_T], item: _T) -> _T:
|
||||
raise IndexError() # if heap is empty
|
||||
def heapreplace(heap: List[_T], item: _T) -> _T: ...
|
||||
def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ...
|
||||
def nlargest(n: int, iterable: Iterable[_T],
|
||||
key: Optional[Callable[[_T], Any]] = ...) -> List[_T]: ...
|
||||
def nsmallest(n: int, iterable: Iterable[_T]) -> List[_T]: ...
|
||||
key: Optional[Callable[[_T], _Sortable]] = ...) -> List[_T]: ...
|
||||
def nsmallest(n: int, iterable: Iterable[_T],
|
||||
key: Optional[Callable[[_T], _Sortable]] = ...) -> List[_T]: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from typing import Any, Mapping
|
||||
from typing import Dict
|
||||
|
||||
name2codepoint: Mapping[str, int]
|
||||
codepoint2name: Mapping[int, str]
|
||||
entitydefs: Mapping[str, str]
|
||||
name2codepoint: Dict[str, int]
|
||||
codepoint2name: Dict[int, str]
|
||||
entitydefs: Dict[str, str]
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ PY_SOURCE: int
|
||||
SEARCH_ERROR: int
|
||||
|
||||
def acquire_lock() -> None: ...
|
||||
def find_module(name: str, path: Iterable[str] = ...) -> Optional[Tuple[str, str, Tuple[str, str, int]]]: ...
|
||||
def find_module(name: str, path: Iterable[str] = ...) -> Optional[Tuple[IO[Any], str, Tuple[str, str, int]]]: ...
|
||||
def get_magic() -> str: ...
|
||||
def get_suffixes() -> List[Tuple[str, str, int]]: ...
|
||||
def init_builtin(name: str) -> types.ModuleType: ...
|
||||
|
||||
+45
-51
@@ -1,4 +1,4 @@
|
||||
from types import CodeType, TracebackType, FrameType, ModuleType
|
||||
from types import CodeType, TracebackType, FrameType, FunctionType, MethodType, ModuleType
|
||||
from typing import Any, Dict, Callable, List, NamedTuple, Optional, Sequence, Tuple, Type, Union
|
||||
|
||||
# Types and members
|
||||
@@ -22,11 +22,12 @@ CO_VARARGS: int
|
||||
CO_VARKEYWORDS: int
|
||||
TPFLAGS_IS_ABSTRACT: int
|
||||
|
||||
ModuleInfo = NamedTuple('ModuleInfo', [('name', str),
|
||||
('suffix', str),
|
||||
('mode', str),
|
||||
('module_type', int),
|
||||
])
|
||||
class ModuleInfo(NamedTuple):
|
||||
name: str
|
||||
suffix: str
|
||||
mode: str
|
||||
module_type: int
|
||||
|
||||
def getmembers(
|
||||
object: object,
|
||||
predicate: Optional[Callable[[Any], bool]] = ...
|
||||
@@ -52,43 +53,40 @@ def isgetsetdescriptor(object: object) -> bool: ...
|
||||
def ismemberdescriptor(object: object) -> bool: ...
|
||||
|
||||
# Retrieving source code
|
||||
def findsource(object: object) -> Tuple[List[str], int]: ...
|
||||
def getabsfile(object: object) -> str: ...
|
||||
_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType, Callable[..., Any]]
|
||||
|
||||
def findsource(object: _SourceObjectType) -> Tuple[List[str], int]: ...
|
||||
def getabsfile(object: _SourceObjectType) -> str: ...
|
||||
def getblock(lines: Sequence[str]) -> Sequence[str]: ...
|
||||
def getdoc(object: object) -> str: ...
|
||||
def getcomments(object: object) -> str: ...
|
||||
def getfile(object: object) -> str: ...
|
||||
def getmodule(object: object) -> ModuleType: ...
|
||||
def getsourcefile(object: object) -> str: ...
|
||||
# TODO restrict to "module, class, method, function, traceback, frame,
|
||||
# or code object"
|
||||
def getsourcelines(object: object) -> Tuple[List[str], int]: ...
|
||||
# TODO restrict to "a module, class, method, function, traceback, frame,
|
||||
# or code object"
|
||||
def getsource(object: object) -> str: ...
|
||||
def getdoc(object: object) -> Optional[str]: ...
|
||||
def getcomments(object: object) -> Optional[str]: ...
|
||||
def getfile(object: _SourceObjectType) -> str: ...
|
||||
def getmodule(object: object) -> Optional[ModuleType]: ...
|
||||
def getsourcefile(object: _SourceObjectType) -> Optional[str]: ...
|
||||
def getsourcelines(object: _SourceObjectType) -> Tuple[List[str], int]: ...
|
||||
def getsource(object: _SourceObjectType) -> str: ...
|
||||
def cleandoc(doc: str) -> str: ...
|
||||
def indentsize(line: str) -> int: ...
|
||||
|
||||
# Classes and functions
|
||||
def getclasstree(classes: List[type], unique: bool = ...) -> List[
|
||||
Union[Tuple[type, Tuple[type, ...]], list]]: ...
|
||||
def getclasstree(classes: List[type], unique: bool = ...) -> List[Union[Tuple[type, Tuple[type, ...]], List[Any]]]: ...
|
||||
|
||||
ArgSpec = NamedTuple('ArgSpec', [('args', List[str]),
|
||||
('varargs', Optional[str]),
|
||||
('keywords', Optional[str]),
|
||||
('defaults', tuple),
|
||||
])
|
||||
class ArgSpec(NamedTuple):
|
||||
args: List[str]
|
||||
varargs: Optional[str]
|
||||
keywords: Optional[str]
|
||||
defaults: Tuple[Any, ...]
|
||||
|
||||
ArgInfo = NamedTuple('ArgInfo', [('args', List[str]),
|
||||
('varargs', Optional[str]),
|
||||
('keywords', Optional[str]),
|
||||
('locals', Dict[str, Any]),
|
||||
])
|
||||
class ArgInfo(NamedTuple):
|
||||
args: List[str]
|
||||
varargs: Optional[str]
|
||||
keywords: Optional[str]
|
||||
locals: Dict[str, Any]
|
||||
|
||||
Arguments = NamedTuple('Arguments', [('args', List[Union[str, List[Any]]]),
|
||||
('varargs', Optional[str]),
|
||||
('keywords', Optional[str]),
|
||||
])
|
||||
class Arguments(NamedTuple):
|
||||
args: List[Union[str, List[Any]]]
|
||||
varargs: Optional[str]
|
||||
keywords: Optional[str]
|
||||
|
||||
def getargs(co: CodeType) -> Arguments: ...
|
||||
def getargspec(func: object) -> ArgSpec: ...
|
||||
@@ -104,18 +102,14 @@ def getcallargs(func, *args, **kwds) -> Dict[str, Any]: ...
|
||||
|
||||
# The interpreter stack
|
||||
|
||||
Traceback = NamedTuple(
|
||||
'Traceback',
|
||||
[
|
||||
('filename', str),
|
||||
('lineno', int),
|
||||
('function', str),
|
||||
('code_context', List[str]),
|
||||
('index', int),
|
||||
]
|
||||
)
|
||||
class Traceback(NamedTuple):
|
||||
filename: str
|
||||
lineno: int
|
||||
function: str
|
||||
code_context: Optional[List[str]]
|
||||
index: Optional[int] # type: ignore
|
||||
|
||||
_FrameInfo = Tuple[FrameType, str, int, str, List[str], int]
|
||||
_FrameInfo = Tuple[FrameType, str, int, str, Optional[List[str]], Optional[int]]
|
||||
|
||||
def getouterframes(frame: FrameType, context: int = ...) -> List[_FrameInfo]: ...
|
||||
def getframeinfo(frame: Union[FrameType, TracebackType], context: int = ...) -> Traceback: ...
|
||||
@@ -126,10 +120,10 @@ def currentframe(depth: int = ...) -> FrameType: ...
|
||||
def stack(context: int = ...) -> List[_FrameInfo]: ...
|
||||
def trace(context: int = ...) -> List[_FrameInfo]: ...
|
||||
|
||||
Attribute = NamedTuple('Attribute', [('name', str),
|
||||
('kind', str),
|
||||
('defining_class', type),
|
||||
('object', object),
|
||||
])
|
||||
class Attribute(NamedTuple):
|
||||
name: str
|
||||
kind: str
|
||||
defining_class: type
|
||||
object: object
|
||||
|
||||
def classify_class_attrs(cls: type) -> List[Attribute]: ...
|
||||
|
||||
@@ -14,8 +14,6 @@ def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
|
||||
def repeat(object: _T, times: int = ...) -> Iterator[_T]: ...
|
||||
|
||||
def accumulate(iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
|
||||
class chain(Iterator[_T], Generic[_T]):
|
||||
def __init__(self, *iterables: Iterable[_T]) -> None: ...
|
||||
def next(self) -> _T: ...
|
||||
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text, Protocol
|
||||
from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text, Protocol, Type
|
||||
|
||||
class JSONDecodeError(ValueError):
|
||||
def dumps(self, obj: Any) -> str: ...
|
||||
@@ -11,7 +11,7 @@ def dumps(obj: Any,
|
||||
ensure_ascii: bool = ...,
|
||||
check_circular: bool = ...,
|
||||
allow_nan: bool = ...,
|
||||
cls: Any = ...,
|
||||
cls: Optional[Type[JSONEncoder]] = ...,
|
||||
indent: Optional[int] = ...,
|
||||
separators: Optional[Tuple[str, str]] = ...,
|
||||
encoding: str = ...,
|
||||
@@ -25,7 +25,7 @@ def dump(obj: Any,
|
||||
ensure_ascii: bool = ...,
|
||||
check_circular: bool = ...,
|
||||
allow_nan: bool = ...,
|
||||
cls: Any = ...,
|
||||
cls: Optional[Type[JSONEncoder]] = ...,
|
||||
indent: Optional[int] = ...,
|
||||
separators: Optional[Tuple[str, str]] = ...,
|
||||
encoding: str = ...,
|
||||
@@ -35,8 +35,8 @@ def dump(obj: Any,
|
||||
|
||||
def loads(s: Union[Text, bytes],
|
||||
encoding: Any = ...,
|
||||
cls: Any = ...,
|
||||
object_hook: Optional[Callable[[Dict], Any]] = ...,
|
||||
cls: Optional[Type[JSONDecoder]] = ...,
|
||||
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
@@ -48,8 +48,8 @@ class _Reader(Protocol):
|
||||
|
||||
def load(fp: _Reader,
|
||||
encoding: Optional[str] = ...,
|
||||
cls: Any = ...,
|
||||
object_hook: Optional[Callable[[Dict], Any]] = ...,
|
||||
cls: Optional[Type[JSONDecoder]] = ...,
|
||||
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
|
||||
+2
-2
@@ -2,5 +2,5 @@
|
||||
|
||||
from hashlib import md5 as md5, md5 as new
|
||||
|
||||
blocksize = 0
|
||||
digest_size = 0
|
||||
blocksize: int
|
||||
digest_size: int
|
||||
|
||||
@@ -14,7 +14,7 @@ from Queue import Queue
|
||||
|
||||
|
||||
class DummyProcess(threading.Thread):
|
||||
_children: weakref.WeakKeyDictionary
|
||||
_children: weakref.WeakKeyDictionary[Any, Any]
|
||||
_parent: threading.Thread
|
||||
_pid: None
|
||||
_start_called: bool
|
||||
@@ -42,10 +42,10 @@ class Value(object):
|
||||
|
||||
JoinableQueue = Queue
|
||||
|
||||
def Array(typecode, sequence, lock=...) -> array.array: ...
|
||||
def Array(typecode, sequence, lock=...) -> array.array[Any]: ...
|
||||
def Manager() -> Any: ...
|
||||
def Pool(processes=..., initializer=..., initargs=...) -> Any: ...
|
||||
def active_children() -> List: ...
|
||||
def active_children() -> List[Any]: ...
|
||||
def current_process() -> threading.Thread: ...
|
||||
def freeze_support() -> None: ...
|
||||
def shutdown() -> None: ...
|
||||
|
||||
@@ -15,7 +15,7 @@ class Connection(object):
|
||||
def poll(self, timeout=...) -> Any: ...
|
||||
|
||||
class Listener(object):
|
||||
_backlog_queue: Optional[Queue]
|
||||
_backlog_queue: Optional[Queue[Any]]
|
||||
address: Any
|
||||
def __init__(self, address=..., family=..., backlog=...) -> None: ...
|
||||
def accept(self) -> Connection: ...
|
||||
|
||||
+2
-3
@@ -1,13 +1,12 @@
|
||||
# Source: https://hg.python.org/cpython/file/2.7/Lib/mutex.py
|
||||
|
||||
from collections import deque
|
||||
from typing import Any, Callable, TypeVar
|
||||
from typing import Any, Callable, Deque, TypeVar
|
||||
|
||||
_ArgType = TypeVar('_ArgType')
|
||||
|
||||
class mutex:
|
||||
locked: bool
|
||||
queue: deque
|
||||
queue: Deque[Any]
|
||||
def __init__(self) -> None: ...
|
||||
def test(self) -> bool: ...
|
||||
def testandset(self) -> bool: ...
|
||||
|
||||
+13
-24
@@ -3,7 +3,7 @@
|
||||
|
||||
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
|
||||
from posix import listdir as listdir, 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,
|
||||
@@ -136,10 +136,17 @@ if sys.version_info >= (3, 6):
|
||||
|
||||
_PathType = path._PathType
|
||||
|
||||
_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)])
|
||||
class _StatVFS(NamedTuple):
|
||||
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 getlogin() -> str: ...
|
||||
def getpid() -> int: ...
|
||||
@@ -192,7 +199,7 @@ def lseek(fd: int, pos: int, how: int) -> int: ...
|
||||
def open(file: _PathType, flags: int, mode: int = ...) -> int: ...
|
||||
def pipe() -> Tuple[int, int]: ...
|
||||
def read(fd: int, n: int) -> bytes: ...
|
||||
def write(fd: int, string: bytes) -> int: ...
|
||||
def write(fd: int, string: Union[bytes, buffer]) -> int: ...
|
||||
def access(path: _PathType, mode: int) -> bool: ...
|
||||
def chdir(path: _PathType) -> None: ...
|
||||
def fchdir(fd: int) -> None: ...
|
||||
@@ -200,7 +207,6 @@ def getcwd() -> str: ...
|
||||
def getcwdu() -> unicode: ...
|
||||
def chmod(path: _PathType, mode: int) -> None: ...
|
||||
def link(src: _PathType, link_name: _PathType) -> None: ...
|
||||
def listdir(path: AnyStr) -> List[AnyStr]: ...
|
||||
def lstat(path: _PathType) -> Any: ...
|
||||
def mknod(filename: _PathType, mode: int = ..., device: int = ...) -> None: ...
|
||||
def major(device: int) -> int: ...
|
||||
@@ -350,20 +356,3 @@ if sys.version_info < (3, 0):
|
||||
P_ALL: int
|
||||
WEXITED: int
|
||||
WNOWAIT: int
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
if sys.platform != 'win32':
|
||||
# Unix only
|
||||
def sync() -> None: ...
|
||||
|
||||
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]]: ...
|
||||
|
||||
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]: ...
|
||||
|
||||
@@ -4,10 +4,7 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import (
|
||||
overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO,
|
||||
TypeVar, Union, Text, Callable, Optional
|
||||
)
|
||||
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
|
||||
@@ -4,10 +4,7 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import (
|
||||
overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO,
|
||||
TypeVar, Union, Text, Callable, Optional
|
||||
)
|
||||
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
|
||||
+7
-7
@@ -5,24 +5,24 @@ _T = TypeVar('_T')
|
||||
|
||||
class Popen3:
|
||||
sts: int
|
||||
cmd: Iterable
|
||||
cmd: Iterable[Any]
|
||||
pid: int
|
||||
tochild: TextIO
|
||||
fromchild: TextIO
|
||||
childerr: Optional[TextIO]
|
||||
def __init__(self, cmd: Iterable = ..., capturestderr: bool = ..., bufsize: int = ...) -> None: ...
|
||||
def __init__(self, cmd: Iterable[Any] = ..., 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: None
|
||||
cmd: Iterable
|
||||
cmd: Iterable[Any]
|
||||
pid: int
|
||||
tochild: TextIO
|
||||
fromchild: TextIO
|
||||
def __init__(self, cmd: Iterable = ..., bufsize: int = ...) -> None: ...
|
||||
def __init__(self, cmd: Iterable[Any] = ..., 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]: ...
|
||||
def popen2(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
|
||||
def popen3(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO, TextIO]: ...
|
||||
def popen4(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
|
||||
|
||||
+9
-13
@@ -1,4 +1,4 @@
|
||||
from typing import Dict, List, Mapping, Tuple, Union, Sequence, IO, Optional, TypeVar
|
||||
from typing import AnyStr, Dict, List, Mapping, Tuple, Union, Sequence, IO, Optional, TypeVar
|
||||
|
||||
error = OSError
|
||||
|
||||
@@ -7,6 +7,8 @@ environ: Dict[str, str]
|
||||
pathconf_names: Dict[str, int]
|
||||
sysconf_names: Dict[str, int]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
EX_CANTCREAT: int
|
||||
EX_CONFIG: int
|
||||
EX_DATAERR: int
|
||||
@@ -111,10 +113,8 @@ def fchmod(fd: int, mode: int) -> None: ...
|
||||
def fchown(fd: int, uid: int, gid: int) -> None: ...
|
||||
def fdatasync(fd: int) -> None: ...
|
||||
def fdopen(fd: int, mode: str = ..., bufsize: int = ...) -> IO[str]: ...
|
||||
def fork() -> int:
|
||||
raise OSError()
|
||||
def forkpty() -> Tuple[int, int]:
|
||||
raise OSError()
|
||||
def fork() -> int: ...
|
||||
def forkpty() -> Tuple[int, int]: ...
|
||||
def fpathconf(fd: int, name: str) -> None: ...
|
||||
def fstat(fd: int) -> stat_result: ...
|
||||
def fstatvfs(fd: int) -> statvfs_result: ...
|
||||
@@ -126,8 +126,7 @@ def getegid() -> int: ...
|
||||
def geteuid() -> int: ...
|
||||
def getgid() -> int: ...
|
||||
def getgroups() -> List[int]: ...
|
||||
def getloadavg() -> Tuple[float, float, float]:
|
||||
raise OSError()
|
||||
def getloadavg() -> Tuple[float, float, float]: ...
|
||||
def getlogin() -> str: ...
|
||||
def getpgid(pid: int) -> int: ...
|
||||
def getpgrp() -> int: ...
|
||||
@@ -143,8 +142,7 @@ def kill(pid: int, sig: int) -> None: ...
|
||||
def killpg(pgid: int, sig: int) -> None: ...
|
||||
def lchown(path: unicode, uid: int, gid: int) -> None: ...
|
||||
def link(source: unicode, link_name: str) -> None: ...
|
||||
_T = TypeVar("_T")
|
||||
def listdir(path: _T) -> List[_T]: ...
|
||||
def listdir(path: AnyStr) -> List[AnyStr]: ...
|
||||
def lseek(fd: int, pos: int, how: int) -> None: ...
|
||||
def lstat(path: unicode) -> stat_result: ...
|
||||
def major(device: int) -> int: ...
|
||||
@@ -194,12 +192,10 @@ def uname() -> Tuple[str, str, str, str, str]: ...
|
||||
def unlink(path: unicode) -> None: ...
|
||||
def unsetenv(varname: str) -> None: ...
|
||||
def urandom(n: int) -> str: ...
|
||||
def utime(path: unicode, times: Optional[Tuple[int, int]]) -> None:
|
||||
raise OSError
|
||||
def utime(path: unicode, times: Optional[Tuple[int, int]]) -> None: ...
|
||||
def wait() -> int: ...
|
||||
_r = Tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int]
|
||||
def wait3(options: int) -> Tuple[int, int, _r]: ...
|
||||
def wait4(pid: int, options: int) -> Tuple[int, int, _r]: ...
|
||||
def waitpid(pid: int, options: int) -> int:
|
||||
raise OSError()
|
||||
def waitpid(pid: int, options: int) -> int: ...
|
||||
def write(fd: int, str: str) -> int: ...
|
||||
|
||||
+9
-7
@@ -7,12 +7,14 @@
|
||||
# ----- random classes -----
|
||||
|
||||
import _random
|
||||
from typing import (
|
||||
Any, TypeVar, Sequence, List, Callable, AbstractSet, Union,
|
||||
overload
|
||||
)
|
||||
from typing import AbstractSet, Any, Callable, Iterator, List, Protocol, Sequence, TypeVar, Union, overload
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T = TypeVar("_T")
|
||||
_T_co = TypeVar('_T_co', covariant=True)
|
||||
|
||||
class _Sampleable(Protocol[_T_co]):
|
||||
def __iter__(self) -> Iterator[_T_co]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class Random(_random.Random):
|
||||
def __init__(self, x: object = ...) -> None: ...
|
||||
@@ -28,7 +30,7 @@ class Random(_random.Random):
|
||||
def randint(self, a: int, b: int) -> int: ...
|
||||
def choice(self, seq: Sequence[_T]) -> _T: ...
|
||||
def shuffle(self, x: List[Any], random: Callable[[], None] = ...) -> None: ...
|
||||
def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
|
||||
def sample(self, population: _Sampleable[_T], k: int) -> List[_T]: ...
|
||||
def random(self) -> float: ...
|
||||
def uniform(self, a: float, b: float) -> float: ...
|
||||
def triangular(self, low: float = ..., high: float = ..., mode: float = ...) -> float: ...
|
||||
@@ -59,7 +61,7 @@ def randrange(start: int, stop: int, step: int = ...) -> int: ...
|
||||
def randint(a: int, b: int) -> int: ...
|
||||
def choice(seq: Sequence[_T]) -> _T: ...
|
||||
def shuffle(x: List[Any], random: Callable[[], float] = ...) -> None: ...
|
||||
def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
|
||||
def sample(population: _Sampleable[_T], k: int) -> List[_T]: ...
|
||||
def random() -> float: ...
|
||||
def uniform(a: float, b: float) -> float: ...
|
||||
def triangular(low: float = ..., high: float = ...,
|
||||
|
||||
+15
-15
@@ -10,21 +10,21 @@ from typing import (
|
||||
)
|
||||
|
||||
# ----- re variables and constants -----
|
||||
DEBUG = 0
|
||||
I = 0
|
||||
IGNORECASE = 0
|
||||
L = 0
|
||||
LOCALE = 0
|
||||
M = 0
|
||||
MULTILINE = 0
|
||||
S = 0
|
||||
DOTALL = 0
|
||||
X = 0
|
||||
VERBOSE = 0
|
||||
U = 0
|
||||
UNICODE = 0
|
||||
T = 0
|
||||
TEMPLATE = 0
|
||||
DEBUG: int
|
||||
I: int
|
||||
IGNORECASE: int
|
||||
L: int
|
||||
LOCALE: int
|
||||
M: int
|
||||
MULTILINE: int
|
||||
S: int
|
||||
DOTALL: int
|
||||
X: int
|
||||
VERBOSE: int
|
||||
U: int
|
||||
UNICODE: int
|
||||
T: int
|
||||
TEMPLATE: int
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
from typing import Any, List
|
||||
|
||||
class Repr:
|
||||
maxarray: int
|
||||
maxdeque: int
|
||||
@@ -25,7 +27,7 @@ class Repr:
|
||||
def repr_str(self, x, level: complex) -> str: ...
|
||||
def repr_tuple(self, x, level: complex) -> str: ...
|
||||
|
||||
def _possibly_sorted(x) -> list: ...
|
||||
def _possibly_sorted(x) -> List[Any]: ...
|
||||
|
||||
aRepr: Repr
|
||||
def repr(x) -> str: ...
|
||||
|
||||
+18
-6
@@ -19,12 +19,24 @@ RLIMIT_MEMLOCK: int
|
||||
RLIMIT_VMEM: int
|
||||
RLIMIT_AS: int
|
||||
|
||||
_RUsage = NamedTuple('_RUsage', [('ru_utime', float), ('ru_stime', float), ('ru_maxrss', int),
|
||||
('ru_ixrss', int), ('ru_idrss', int), ('ru_isrss', int),
|
||||
('ru_minflt', int), ('ru_majflt', int), ('ru_nswap', int),
|
||||
('ru_inblock', int), ('ru_oublock', int), ('ru_msgsnd', int),
|
||||
('ru_msgrcv', int), ('ru_nsignals', int), ('ru_nvcsw', int),
|
||||
('ru_nivcsw', int)])
|
||||
class _RUsage(NamedTuple):
|
||||
ru_utime: float
|
||||
ru_stime: float
|
||||
ru_maxrss: int
|
||||
ru_ixrss: int
|
||||
ru_idrss: int
|
||||
ru_isrss: int
|
||||
ru_minflt: int
|
||||
ru_majflt: int
|
||||
ru_nswap: int
|
||||
ru_inblock: int
|
||||
ru_oublock: int
|
||||
ru_msgsnd: int
|
||||
ru_msgrcv: int
|
||||
ru_nsignals: int
|
||||
ru_nvcsw: int
|
||||
ru_nivcsw: int
|
||||
|
||||
def getrusage(who: int) -> _RUsage: ...
|
||||
def getpagesize() -> int: ...
|
||||
|
||||
|
||||
+16
-16
@@ -3,7 +3,7 @@ from typing import Any, Callable, Hashable, Iterable, Iterator, MutableMapping,
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_Setlike = Union[BaseSet[_T], Iterable[_T]]
|
||||
_SelfT = TypeVar('_SelfT', bound=BaseSet)
|
||||
_SelfT = TypeVar('_SelfT')
|
||||
|
||||
class BaseSet(Iterable[_T]):
|
||||
def __init__(self) -> None: ...
|
||||
@@ -18,13 +18,13 @@ class BaseSet(Iterable[_T]):
|
||||
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 union(self: _SelfT, other: _Setlike[_T]) -> _SelfT: ...
|
||||
def __and__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def intersection(self: _SelfT, other: _Setlike) -> _SelfT: ...
|
||||
def intersection(self: _SelfT, other: _Setlike[Any]) -> _SelfT: ...
|
||||
def __xor__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def symmetric_difference(self: _SelfT, other: _Setlike) -> _SelfT: ...
|
||||
def symmetric_difference(self: _SelfT, other: _Setlike[_T]) -> _SelfT: ...
|
||||
def __sub__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def difference(self: _SelfT, other: _Setlike) -> _SelfT: ...
|
||||
def difference(self: _SelfT, other: _Setlike[Any]) -> _SelfT: ...
|
||||
def __contains__(self, element: Any) -> bool: ...
|
||||
def issubset(self, other: BaseSet[_T]) -> bool: ...
|
||||
def issuperset(self, other: BaseSet[_T]) -> bool: ...
|
||||
@@ -34,20 +34,20 @@ class BaseSet(Iterable[_T]):
|
||||
def __gt__(self, other: BaseSet[_T]) -> bool: ...
|
||||
|
||||
class ImmutableSet(BaseSet[_T], Hashable):
|
||||
def __init__(self, iterable: Optional[_Setlike] = ...) -> None: ...
|
||||
def __init__(self, iterable: Optional[_Setlike[_T]] = ...) -> 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 __init__(self, iterable: Optional[_Setlike[_T]] = ...) -> None: ...
|
||||
def __ior__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def union_update(self, other: _Setlike[_T]) -> None: ...
|
||||
def __iand__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def intersection_update(self, other: _Setlike[Any]) -> None: ...
|
||||
def __ixor__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def symmetric_difference_update(self, other: _Setlike[_T]) -> None: ...
|
||||
def __isub__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def difference_update(self, other: _Setlike[Any]) -> None: ...
|
||||
def update(self, iterable: _Setlike[_T]) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def add(self, element: _T) -> None: ...
|
||||
def remove(self, element: _T) -> None: ...
|
||||
|
||||
+2
-2
@@ -7,5 +7,5 @@ class sha(object):
|
||||
def copy(self) -> sha: ...
|
||||
|
||||
def new(string: str = ...) -> sha: ...
|
||||
blocksize = 0
|
||||
digest_size = 0
|
||||
blocksize: int
|
||||
digest_size: int
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ from typing import Any, Dict, Iterator, List, Optional, Tuple
|
||||
import collections
|
||||
|
||||
|
||||
class Shelf(collections.MutableMapping):
|
||||
class Shelf(collections.MutableMapping[Any, Any]):
|
||||
def __init__(self, dict: Dict[Any, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def keys(self) -> List[Any]: ...
|
||||
|
||||
@@ -7,6 +7,7 @@ _SLT = TypeVar('_SLT', bound=shlex)
|
||||
class shlex:
|
||||
def __init__(self, instream: IO[Any] = ..., infile: IO[Any] = ..., posix: bool = ...) -> None: ...
|
||||
def __iter__(self: _SLT) -> _SLT: ...
|
||||
def next(self) -> str: ...
|
||||
def get_token(self) -> Optional[str]: ...
|
||||
def push_token(self, _str: str) -> None: ...
|
||||
def read_token(self) -> str: ...
|
||||
|
||||
+3
-6
@@ -63,9 +63,6 @@ def pause() -> None: ...
|
||||
def setitimer(which: int, seconds: float, interval: float = ...) -> Tuple[float, float]: ...
|
||||
def getitimer(which: int) -> Tuple[float, float]: ...
|
||||
def set_wakeup_fd(fd: int) -> int: ...
|
||||
def siginterrupt(signalnum: int, flag: bool) -> None:
|
||||
raise RuntimeError()
|
||||
def signal(signalnum: int, handler: _HANDLER) -> _HANDLER:
|
||||
raise RuntimeError()
|
||||
def default_int_handler(signum: int, frame: FrameType) -> None:
|
||||
raise KeyboardInterrupt()
|
||||
def siginterrupt(signalnum: int, flag: bool) -> None: ...
|
||||
def signal(signalnum: int, handler: _HANDLER) -> _HANDLER: ...
|
||||
def default_int_handler(signum: int, frame: FrameType) -> None: ...
|
||||
|
||||
+10
-9
@@ -1,14 +1,15 @@
|
||||
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)])
|
||||
class struct_spwd(NamedTuple):
|
||||
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: ...
|
||||
|
||||
@@ -4,10 +4,10 @@ from typing import Any, Dict, Iterable, List, Match, Optional, Pattern as _Patte
|
||||
|
||||
SPECIAL_CHARS: str
|
||||
REPEAT_CHARS: str
|
||||
DIGITS: Set
|
||||
OCTDIGITS: Set
|
||||
HEXDIGITS: Set
|
||||
WHITESPACE: Set
|
||||
DIGITS: Set[Any]
|
||||
OCTDIGITS: Set[Any]
|
||||
HEXDIGITS: Set[Any]
|
||||
WHITESPACE: Set[Any]
|
||||
ESCAPES: Dict[str, Tuple[str, int]]
|
||||
CATEGORIES: Dict[str, Union[Tuple[str, str], Tuple[str, List[Tuple[str, str]]]]]
|
||||
FLAGS: Dict[str, int]
|
||||
@@ -59,5 +59,5 @@ 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: ...
|
||||
def parse_template(source: str, pattern: _Pattern[Any]) -> _Template: ...
|
||||
def expand_template(template: _Template, match: Match[Any]) -> str: ...
|
||||
|
||||
+48
-48
@@ -9,51 +9,51 @@ def S_ISSOCK(mode: int) -> bool: ...
|
||||
def S_IMODE(mode: int) -> int: ...
|
||||
def S_IFMT(mode: int) -> int: ...
|
||||
|
||||
ST_MODE = 0
|
||||
ST_INO = 0
|
||||
ST_DEV = 0
|
||||
ST_NLINK = 0
|
||||
ST_UID = 0
|
||||
ST_GID = 0
|
||||
ST_SIZE = 0
|
||||
ST_ATIME = 0
|
||||
ST_MTIME = 0
|
||||
ST_CTIME = 0
|
||||
S_IFSOCK = 0
|
||||
S_IFLNK = 0
|
||||
S_IFREG = 0
|
||||
S_IFBLK = 0
|
||||
S_IFDIR = 0
|
||||
S_IFCHR = 0
|
||||
S_IFIFO = 0
|
||||
S_ISUID = 0
|
||||
S_ISGID = 0
|
||||
S_ISVTX = 0
|
||||
S_IRWXU = 0
|
||||
S_IRUSR = 0
|
||||
S_IWUSR = 0
|
||||
S_IXUSR = 0
|
||||
S_IRWXG = 0
|
||||
S_IRGRP = 0
|
||||
S_IWGRP = 0
|
||||
S_IXGRP = 0
|
||||
S_IRWXO = 0
|
||||
S_IROTH = 0
|
||||
S_IWOTH = 0
|
||||
S_IXOTH = 0
|
||||
S_ENFMT = 0
|
||||
S_IREAD = 0
|
||||
S_IWRITE = 0
|
||||
S_IEXEC = 0
|
||||
UF_NODUMP = 0
|
||||
UF_IMMUTABLE = 0
|
||||
UF_APPEND = 0
|
||||
UF_OPAQUE = 0
|
||||
UF_NOUNLINK = 0
|
||||
UF_COMPRESSED = 0
|
||||
UF_HIDDEN = 0
|
||||
SF_ARCHIVED = 0
|
||||
SF_IMMUTABLE = 0
|
||||
SF_APPEND = 0
|
||||
SF_NOUNLINK = 0
|
||||
SF_SNAPSHOT = 0
|
||||
ST_MODE: int
|
||||
ST_INO: int
|
||||
ST_DEV: int
|
||||
ST_NLINK: int
|
||||
ST_UID: int
|
||||
ST_GID: int
|
||||
ST_SIZE: int
|
||||
ST_ATIME: int
|
||||
ST_MTIME: int
|
||||
ST_CTIME: int
|
||||
S_IFSOCK: int
|
||||
S_IFLNK: int
|
||||
S_IFREG: int
|
||||
S_IFBLK: int
|
||||
S_IFDIR: int
|
||||
S_IFCHR: int
|
||||
S_IFIFO: int
|
||||
S_ISUID: int
|
||||
S_ISGID: int
|
||||
S_ISVTX: int
|
||||
S_IRWXU: int
|
||||
S_IRUSR: int
|
||||
S_IWUSR: int
|
||||
S_IXUSR: int
|
||||
S_IRWXG: int
|
||||
S_IRGRP: int
|
||||
S_IWGRP: int
|
||||
S_IXGRP: int
|
||||
S_IRWXO: int
|
||||
S_IROTH: int
|
||||
S_IWOTH: int
|
||||
S_IXOTH: int
|
||||
S_ENFMT: int
|
||||
S_IREAD: int
|
||||
S_IWRITE: int
|
||||
S_IEXEC: int
|
||||
UF_NODUMP: int
|
||||
UF_IMMUTABLE: int
|
||||
UF_APPEND: int
|
||||
UF_OPAQUE: int
|
||||
UF_NOUNLINK: int
|
||||
UF_COMPRESSED: int
|
||||
UF_HIDDEN: int
|
||||
SF_ARCHIVED: int
|
||||
SF_IMMUTABLE: int
|
||||
SF_APPEND: int
|
||||
SF_NOUNLINK: int
|
||||
SF_SNAPSHOT: int
|
||||
|
||||
+1
-4
@@ -68,10 +68,7 @@ class Formatter(object):
|
||||
def parse(self, format_string: str) -> Iterable[Tuple[str, str, str, str]]: ...
|
||||
def get_field(self, field_name: str, args: Sequence[Any],
|
||||
kwargs: Mapping[str, Any]) -> Any: ...
|
||||
def get_value(self, key: Union[int, str], args: Sequence[Any],
|
||||
kwargs: Mapping[str, Any]) -> Any:
|
||||
raise IndexError()
|
||||
raise KeyError()
|
||||
def get_value(self, key: Union[int, str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
|
||||
def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any],
|
||||
kwargs: Mapping[str, Any]) -> None: ...
|
||||
def format_field(self, value: Any, format_spec: str) -> Any: ...
|
||||
|
||||
+20
-63
@@ -6,67 +6,24 @@ lowercase: str
|
||||
uppercase: str
|
||||
whitespace: str
|
||||
|
||||
def atof(a: str) -> float:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def atoi(a: str, base: int = ...) -> int:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def atol(a: str, base: int = ...) -> long:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def capitalize(s: str) -> str:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def count(s: str, sub: str, start: int = ..., end: int = ...) -> int:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def expandtabs(string: str, tabsize: int = ...) -> str:
|
||||
raise DeprecationWarning()
|
||||
raise OverflowError()
|
||||
|
||||
def find(s: str, sub: str, start: int = ..., end: int = ...) -> int:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def join(list: Sequence[str], sep: str = ...) -> str:
|
||||
raise DeprecationWarning()
|
||||
raise OverflowError()
|
||||
|
||||
def joinfields(list: Sequence[str], sep: str = ...) -> str:
|
||||
raise DeprecationWarning()
|
||||
raise OverflowError()
|
||||
|
||||
def lower(s: str) -> str:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def lstrip(s: str) -> str:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def atof(a: str) -> float: ...
|
||||
def atoi(a: str, base: int = ...) -> int: ...
|
||||
def atol(a: str, base: int = ...) -> long: ...
|
||||
def capitalize(s: str) -> str: ...
|
||||
def count(s: str, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
def expandtabs(string: str, tabsize: int = ...) -> str: ...
|
||||
def find(s: str, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
def join(list: Sequence[str], sep: str = ...) -> str: ...
|
||||
def joinfields(list: Sequence[str], sep: str = ...) -> str: ...
|
||||
def lower(s: str) -> str: ...
|
||||
def lstrip(s: str) -> str: ...
|
||||
def maketrans(frm: str, to: str) -> str: ...
|
||||
|
||||
def replace(s: str, old: str, new: str, maxsplit: int = ...) -> str:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def rfind(s: str, sub: str, start: int = ..., end: int = ...) -> int:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def rstrip(s: str) -> str:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def split(s: str, sep: str, maxsplit: int = ...) -> List[str]:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def splitfields(s: str, sep: str, maxsplit: int = ...) -> List[str]:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def strip(s: str) -> str:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def swapcase(s: str) -> str:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def translate(s: str, table: str, deletechars: str = ...) -> str:
|
||||
raise DeprecationWarning()
|
||||
|
||||
def upper(s: str) -> str:
|
||||
raise DeprecationWarning()
|
||||
def replace(s: str, old: str, new: str, maxsplit: int = ...) -> str: ...
|
||||
def rfind(s: str, sub: str, start: int = ..., end: int = ...) -> int: ...
|
||||
def rstrip(s: str) -> str: ...
|
||||
def split(s: str, sep: str, maxsplit: int = ...) -> List[str]: ...
|
||||
def splitfields(s: str, sep: str, maxsplit: int = ...) -> List[str]: ...
|
||||
def strip(s: str) -> str: ...
|
||||
def swapcase(s: str) -> str: ...
|
||||
def translate(s: str, table: str, deletechars: str = ...) -> str: ...
|
||||
def upper(s: str) -> str: ...
|
||||
|
||||
+30
-27
@@ -2,7 +2,9 @@
|
||||
|
||||
# Based on http://docs.python.org/2/library/subprocess.html and Python 3 stub
|
||||
|
||||
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Union, Optional, List, Text
|
||||
from typing import (
|
||||
Sequence, Any, Mapping, Callable, Tuple, IO, Union, Optional, List, Text, TypeVar, Generic,
|
||||
)
|
||||
|
||||
_FILE = Union[None, int, IO[Any]]
|
||||
_TXT = Union[bytes, Text]
|
||||
@@ -59,49 +61,50 @@ PIPE: int
|
||||
STDOUT: int
|
||||
|
||||
class CalledProcessError(Exception):
|
||||
returncode = 0
|
||||
returncode: int
|
||||
# morally: _CMD
|
||||
cmd: Any
|
||||
# morally: Optional[bytes]
|
||||
output: Any
|
||||
output: bytes
|
||||
|
||||
def __init__(self,
|
||||
returncode: int,
|
||||
cmd: _CMD,
|
||||
output: Optional[bytes] = ...) -> None: ...
|
||||
|
||||
class Popen:
|
||||
stdin: Optional[IO[Any]]
|
||||
stdout: Optional[IO[Any]]
|
||||
stderr: Optional[IO[Any]]
|
||||
pid = 0
|
||||
returncode = 0
|
||||
# We use a dummy type variable used to make Popen generic like it is in python 3
|
||||
_T = TypeVar('_T', bound=bytes)
|
||||
|
||||
def __init__(self,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[_TXT] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[_TXT] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
creationflags: int = ...) -> None: ...
|
||||
class Popen(Generic[_T]):
|
||||
stdin: Optional[IO[bytes]]
|
||||
stdout: Optional[IO[bytes]]
|
||||
stderr: Optional[IO[bytes]]
|
||||
pid: int
|
||||
returncode: int
|
||||
|
||||
def __new__(cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[_TXT] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[_TXT] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
creationflags: int = ...) -> Popen[bytes]: ...
|
||||
|
||||
def poll(self) -> int: ...
|
||||
def wait(self) -> int: ...
|
||||
# morally: -> Tuple[Optional[bytes], Optional[bytes]]
|
||||
def communicate(self, input: Optional[_TXT] = ...) -> Tuple[Any, Any]: ...
|
||||
def communicate(self, input: Optional[_TXT] = ...) -> Tuple[bytes, bytes]: ...
|
||||
def send_signal(self, signal: int) -> None: ...
|
||||
def terminate(self) -> None: ...
|
||||
def kill(self) -> None: ...
|
||||
def __enter__(self) -> Popen: ...
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
|
||||
def list2cmdline(seq: Sequence[str]) -> str: ... # undocumented
|
||||
|
||||
|
||||
+7
-9
@@ -8,7 +8,7 @@ from types import FrameType, ModuleType, TracebackType, ClassType
|
||||
|
||||
# The following type alias are stub-only and do not exist during runtime
|
||||
_ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
|
||||
_OptExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
_OptExcInfo = Union[_ExcInfo, Tuple[None, None, None]]
|
||||
|
||||
class _flags:
|
||||
bytes_warning: int
|
||||
@@ -42,11 +42,11 @@ class _float_info:
|
||||
rounds: int
|
||||
|
||||
class _version_info(Tuple[int, int, int, str, int]):
|
||||
major = 0
|
||||
minor = 0
|
||||
micro = 0
|
||||
major: int
|
||||
minor: int
|
||||
micro: int
|
||||
releaselevel: str
|
||||
serial = 0
|
||||
serial: int
|
||||
|
||||
_mercurial: Tuple[str, str, str]
|
||||
api_version: int
|
||||
@@ -114,13 +114,11 @@ def _getframe(depth: int = ...) -> FrameType: ...
|
||||
def call_tracing(fn: Any, args: Any) -> Any: ...
|
||||
def __displayhook__(value: int) -> None: ...
|
||||
def __excepthook__(type_: type, value: BaseException, traceback: TracebackType) -> None: ...
|
||||
def exc_clear() -> None:
|
||||
raise DeprecationWarning()
|
||||
def exc_clear() -> None: ...
|
||||
def exc_info() -> _OptExcInfo: ...
|
||||
|
||||
# sys.exit() accepts an optional argument of anything printable
|
||||
def exit(arg: Any = ...) -> NoReturn:
|
||||
raise SystemExit()
|
||||
def exit(arg: Any = ...) -> NoReturn: ...
|
||||
def getcheckinterval() -> int: ... # deprecated
|
||||
def getdefaultencoding() -> str: ...
|
||||
def getdlopenflags() -> int: ...
|
||||
|
||||
@@ -19,12 +19,12 @@ class _RandomNameSequence:
|
||||
|
||||
class _TemporaryFileWrapper(IO[str]):
|
||||
delete: bool
|
||||
file: IO
|
||||
file: IO[str]
|
||||
name: Any
|
||||
def __init__(self, file: IO, name: Any, delete: bool = ...) -> None: ...
|
||||
def __init__(self, file: IO[str], name: Any, delete: bool = ...) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> _TemporaryFileWrapper: ...
|
||||
def __exit__(self, exc, value, tb) -> bool: ...
|
||||
def __exit__(self, exc, value, tb) -> Optional[bool]: ...
|
||||
def __getattr__(self, name: unicode) -> Any: ...
|
||||
def close(self) -> None: ...
|
||||
def unlink(self, path: unicode) -> None: ...
|
||||
@@ -88,7 +88,7 @@ class TemporaryDirectory:
|
||||
dir: Union[bytes, unicode] = ...) -> None: ...
|
||||
def cleanup(self) -> None: ...
|
||||
def __enter__(self) -> Any: ... # Can be str or unicode
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
def __exit__(self, type, value, traceback) -> None: ...
|
||||
|
||||
@overload
|
||||
def mkstemp() -> Tuple[int, str]: ...
|
||||
|
||||
+2
-4
@@ -21,10 +21,8 @@ class _localdummy(object): ...
|
||||
def start_new(function: Callable[..., Any], args: Any, kwargs: Any = ...) -> int: ...
|
||||
def start_new_thread(function: Callable[..., Any], args: Any, kwargs: Any = ...) -> int: ...
|
||||
def interrupt_main() -> None: ...
|
||||
def exit() -> None:
|
||||
raise SystemExit()
|
||||
def exit_thread() -> Any:
|
||||
raise SystemExit()
|
||||
def exit() -> None: ...
|
||||
def exit_thread() -> Any: ...
|
||||
def allocate_lock() -> LockType: ...
|
||||
def get_ident() -> int: ...
|
||||
def stack_size(size: int = ...) -> int: ...
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
from pipes import Template
|
||||
from typing import Dict, List
|
||||
|
||||
|
||||
__all__: List[str]
|
||||
table: Dict[str, Template]
|
||||
t: Template
|
||||
uncompress: Template
|
||||
|
||||
+19
-2
@@ -64,6 +64,23 @@ class CodeType:
|
||||
co_nlocals: int
|
||||
co_stacksize: int
|
||||
co_varnames: Tuple[str, ...]
|
||||
def __init__(
|
||||
self,
|
||||
argcount: int,
|
||||
nlocals: int,
|
||||
stacksize: int,
|
||||
flags: int,
|
||||
codestring: str,
|
||||
constants: Tuple[Any, ...],
|
||||
names: Tuple[str, ...],
|
||||
varnames: Tuple[str, ...],
|
||||
filename: str,
|
||||
name: str,
|
||||
firstlineno: int,
|
||||
lnotab: str,
|
||||
freevars: Tuple[str, ...] = ...,
|
||||
cellvars: Tuple[str, ...] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class GeneratorType:
|
||||
gi_code: CodeType
|
||||
@@ -86,7 +103,7 @@ class UnboundMethodType:
|
||||
__name__: str
|
||||
__func__ = im_func
|
||||
__self__ = im_self
|
||||
def __init__(self, func: Callable, obj: object) -> None: ...
|
||||
def __init__(self, func: Callable[..., Any], obj: object) -> None: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
class InstanceType(object): ...
|
||||
@@ -137,7 +154,7 @@ class EllipsisType: ...
|
||||
class DictProxyType:
|
||||
# TODO is it possible to have non-string keys?
|
||||
# no __init__
|
||||
def copy(self) -> dict: ...
|
||||
def copy(self) -> Dict[Any, Any]: ...
|
||||
def get(self, key: str, default: _T = ...) -> Union[Any, _T]: ...
|
||||
def has_key(self, key: str) -> bool: ...
|
||||
def items(self) -> List[Tuple[str, Any]]: ...
|
||||
|
||||
+59
-33
@@ -11,7 +11,6 @@ overload = object()
|
||||
Any = object()
|
||||
TypeVar = object()
|
||||
_promote = object()
|
||||
no_type_check = object()
|
||||
|
||||
class _SpecialForm(object):
|
||||
def __getitem__(self, typeargs: Any) -> object: ...
|
||||
@@ -22,6 +21,12 @@ Protocol: _SpecialForm = ...
|
||||
Callable: _SpecialForm = ...
|
||||
Type: _SpecialForm = ...
|
||||
ClassVar: _SpecialForm = ...
|
||||
Final: _SpecialForm = ...
|
||||
_F = TypeVar('_F', bound=Callable[..., Any])
|
||||
def final(f: _F) -> _F: ...
|
||||
Literal: _SpecialForm = ...
|
||||
# TypedDict is a (non-subscriptable) special form.
|
||||
TypedDict: object = ...
|
||||
|
||||
class GenericMeta(type): ...
|
||||
|
||||
@@ -30,6 +35,22 @@ class GenericMeta(type): ...
|
||||
# distinguish the None type from the None value.
|
||||
NoReturn = Union[None]
|
||||
|
||||
# These type variables are used by the container types.
|
||||
_T = TypeVar('_T')
|
||||
_S = TypeVar('_S')
|
||||
_KT = TypeVar('_KT') # Key type.
|
||||
_VT = TypeVar('_VT') # Value type.
|
||||
_T_co = TypeVar('_T_co', covariant=True) # Any type covariant containers.
|
||||
_V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers.
|
||||
_KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers.
|
||||
_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers.
|
||||
_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant.
|
||||
_TC = TypeVar('_TC', bound=Type[object])
|
||||
_C = TypeVar("_C", bound=Callable[..., Any])
|
||||
|
||||
no_type_check = object()
|
||||
def no_type_check_decorator(decorator: _C) -> _C: ...
|
||||
|
||||
# Type aliases and type constructors
|
||||
|
||||
class TypeAlias:
|
||||
@@ -52,52 +73,39 @@ AnyStr = TypeVar('AnyStr', str, unicode)
|
||||
|
||||
# Abstract base classes.
|
||||
|
||||
# These type variables are used by the container types.
|
||||
_T = TypeVar('_T')
|
||||
_S = TypeVar('_S')
|
||||
_KT = TypeVar('_KT') # Key type.
|
||||
_VT = TypeVar('_VT') # Value type.
|
||||
_T_co = TypeVar('_T_co', covariant=True) # Any type covariant containers.
|
||||
_V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers.
|
||||
_KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers.
|
||||
_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers.
|
||||
_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant.
|
||||
_TC = TypeVar('_TC', bound=Type[object])
|
||||
_C = TypeVar("_C", bound=Callable)
|
||||
def runtime_checkable(cls: _TC) -> _TC: ...
|
||||
|
||||
def runtime(cls: _TC) -> _TC: ...
|
||||
|
||||
@runtime
|
||||
@runtime_checkable
|
||||
class SupportsInt(Protocol, metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def __int__(self) -> int: ...
|
||||
|
||||
@runtime
|
||||
@runtime_checkable
|
||||
class SupportsFloat(Protocol, metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def __float__(self) -> float: ...
|
||||
|
||||
@runtime
|
||||
@runtime_checkable
|
||||
class SupportsComplex(Protocol, metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def __complex__(self) -> complex: ...
|
||||
|
||||
@runtime
|
||||
@runtime_checkable
|
||||
class SupportsAbs(Protocol[_T_co]):
|
||||
@abstractmethod
|
||||
def __abs__(self) -> _T_co: ...
|
||||
|
||||
@runtime
|
||||
@runtime_checkable
|
||||
class Reversible(Protocol[_T_co]):
|
||||
@abstractmethod
|
||||
def __reversed__(self) -> Iterator[_T_co]: ...
|
||||
|
||||
@runtime
|
||||
@runtime_checkable
|
||||
class Sized(Protocol, metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@runtime
|
||||
@runtime_checkable
|
||||
class Hashable(Protocol, metaclass=ABCMeta):
|
||||
# TODO: This is special, in that a subclass of a hashable class may not be hashable
|
||||
# (for example, list vs. object). It's not obvious how to represent this. This class
|
||||
@@ -105,12 +113,12 @@ class Hashable(Protocol, metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
@runtime
|
||||
@runtime_checkable
|
||||
class Iterable(Protocol[_T_co]):
|
||||
@abstractmethod
|
||||
def __iter__(self) -> Iterator[_T_co]: ...
|
||||
|
||||
@runtime
|
||||
@runtime_checkable
|
||||
class Iterator(Iterable[_T_co], Protocol[_T_co]):
|
||||
@abstractmethod
|
||||
def next(self) -> _T_co: ...
|
||||
@@ -135,7 +143,7 @@ class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):
|
||||
@property
|
||||
def gi_running(self) -> bool: ...
|
||||
|
||||
@runtime
|
||||
@runtime_checkable
|
||||
class Container(Protocol[_T_co]):
|
||||
@abstractmethod
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
@@ -234,7 +242,7 @@ class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]):
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_VT_co]: ...
|
||||
|
||||
@runtime
|
||||
@runtime_checkable
|
||||
class ContextManager(Protocol[_T_co]):
|
||||
def __enter__(self) -> _T_co: ...
|
||||
def __exit__(self, __exc_type: Optional[Type[BaseException]],
|
||||
@@ -337,7 +345,7 @@ class IO(Iterator[AnyStr], Generic[AnyStr]):
|
||||
def __enter__(self) -> IO[AnyStr]: ...
|
||||
@abstractmethod
|
||||
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException],
|
||||
traceback: Optional[TracebackType]) -> bool: ...
|
||||
traceback: Optional[TracebackType]) -> Optional[bool]: ...
|
||||
|
||||
class BinaryIO(IO[str]):
|
||||
# TODO readinto
|
||||
@@ -398,6 +406,8 @@ class Match(Generic[AnyStr]):
|
||||
def start(self, group: Union[int, str] = ...) -> int: ...
|
||||
def end(self, group: Union[int, str] = ...) -> int: ...
|
||||
def span(self, group: Union[int, str] = ...) -> Tuple[int, int]: ...
|
||||
@property
|
||||
def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented
|
||||
|
||||
# We need a second TypeVar with the same definition as AnyStr, because
|
||||
# Pattern is generic over AnyStr (determining the type of its .pattern
|
||||
@@ -439,8 +449,9 @@ class Pattern(Generic[AnyStr]):
|
||||
|
||||
# Functions
|
||||
|
||||
def get_type_hints(obj: Callable, globalns: Optional[dict[Text, Any]] = ...,
|
||||
localns: Optional[dict[Text, Any]] = ...) -> None: ...
|
||||
def get_type_hints(
|
||||
obj: Callable[..., Any], globalns: Optional[Dict[Text, Any]] = ..., localns: Optional[Dict[Text, Any]] = ...,
|
||||
) -> None: ...
|
||||
|
||||
@overload
|
||||
def cast(tp: Type[_T], obj: Any) -> _T: ...
|
||||
@@ -450,18 +461,33 @@ def cast(tp: str, obj: Any) -> Any: ...
|
||||
# Type constructors
|
||||
|
||||
# NamedTuple is special-cased in the type checker
|
||||
class NamedTuple(tuple):
|
||||
class NamedTuple(Tuple[Any, ...]):
|
||||
_fields: Tuple[str, ...]
|
||||
|
||||
def __init__(self, typename: Text, fields: Iterable[Tuple[Text, Any]] = ..., *,
|
||||
verbose: bool = ..., rename: bool = ..., **kwargs: Any) -> None: ...
|
||||
def __init__(self, typename: Text, fields: Iterable[Tuple[Text, Any]] = ...,
|
||||
**kwargs: Any) -> None: ...
|
||||
|
||||
@classmethod
|
||||
def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ...
|
||||
|
||||
def _asdict(self) -> dict: ...
|
||||
def _asdict(self) -> Dict[str, Any]: ...
|
||||
def _replace(self: _T, **kwargs: Any) -> _T: ...
|
||||
|
||||
# Internal mypy fallback type for all typed dicts (does not exist at runtime)
|
||||
class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
|
||||
def copy(self: _T) -> _T: ...
|
||||
# Using NoReturn so that only calls using mypy plugin hook that specialize the signature
|
||||
# can go through.
|
||||
def setdefault(self, k: NoReturn, default: object) -> object: ...
|
||||
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
|
||||
def pop(self, k: NoReturn, default: _T = ...) -> object: ...
|
||||
def update(self: _T, __m: _T) -> None: ...
|
||||
def has_key(self, k: str) -> bool: ...
|
||||
def viewitems(self) -> ItemsView[str, object]: ...
|
||||
def viewkeys(self) -> KeysView[str]: ...
|
||||
def viewvalues(self) -> ValuesView[object]: ...
|
||||
def __delitem__(self, k: NoReturn) -> None: ...
|
||||
|
||||
def NewType(name: str, tp: Type[_T]) -> Type[_T]: ...
|
||||
|
||||
# This itself is only available during type checking
|
||||
|
||||
+23
-3
@@ -3,9 +3,10 @@
|
||||
# Based on http://docs.python.org/2.7/library/unittest.html
|
||||
|
||||
from typing import (Any, Callable, Dict, FrozenSet, Iterable, Iterator,
|
||||
List, NoReturn, Optional, overload, Pattern, Sequence, Set,
|
||||
Text, TextIO, Tuple, Type, TypeVar, Union)
|
||||
List, Mapping, NoReturn, Optional, overload, Pattern,
|
||||
Sequence, Set, Text, TextIO, Tuple, Type, TypeVar, Union)
|
||||
from abc import abstractmethod, ABCMeta
|
||||
import datetime
|
||||
import types
|
||||
|
||||
_T = TypeVar('_T')
|
||||
@@ -96,11 +97,19 @@ class TestCase(Testable):
|
||||
def assertAlmostEqual(self, first: float, second: float, *,
|
||||
msg: Any = ..., delta: float = ...) -> None: ...
|
||||
@overload
|
||||
def assertAlmostEqual(self, first: datetime.datetime,
|
||||
second: datetime.datetime, *,
|
||||
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
|
||||
@overload
|
||||
def assertAlmostEquals(self, first: float, second: float,
|
||||
places: int = ..., msg: Any = ...) -> None: ...
|
||||
@overload
|
||||
def assertAlmostEquals(self, first: float, second: float, *,
|
||||
msg: Any = ..., delta: float = ...) -> None: ...
|
||||
@overload
|
||||
def assertAlmostEquals(self, first: datetime.datetime,
|
||||
second: datetime.datetime, *,
|
||||
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
|
||||
def failUnlessAlmostEqual(self, first: float, second: float, places: int = ...,
|
||||
msg: object = ...) -> None: ...
|
||||
@overload
|
||||
@@ -110,11 +119,19 @@ class TestCase(Testable):
|
||||
def assertNotAlmostEqual(self, first: float, second: float, *,
|
||||
msg: Any = ..., delta: float = ...) -> None: ...
|
||||
@overload
|
||||
def assertNotAlmostEqual(self, first: datetime.datetime,
|
||||
second: datetime.datetime, *,
|
||||
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
|
||||
@overload
|
||||
def assertNotAlmostEquals(self, first: float, second: float,
|
||||
places: int = ..., msg: Any = ...) -> None: ...
|
||||
@overload
|
||||
def assertNotAlmostEquals(self, first: float, second: float, *,
|
||||
msg: Any = ..., delta: float = ...) -> None: ...
|
||||
@overload
|
||||
def assertNotAlmostEquals(self, first: datetime.datetime,
|
||||
second: datetime.datetime, *,
|
||||
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
|
||||
def failIfAlmostEqual(self, first: float, second: float, places: int = ...,
|
||||
msg: object = ...,
|
||||
delta: float = ...) -> None: ...
|
||||
@@ -149,7 +166,10 @@ class TestCase(Testable):
|
||||
def assertRegexpMatches(self, text: Text, regexp: _Regexp, msg: object = ...) -> None: ...
|
||||
def assertNotRegexpMatches(self, text: Text, regexp: _Regexp, msg: object = ...) -> None: ...
|
||||
def assertItemsEqual(self, first: Iterable[Any], second: Iterable[Any], msg: object = ...) -> None: ...
|
||||
def assertDictContainsSubset(self, expected: Dict[Any, Any], actual: Dict[Any, Any], msg: object = ...) -> None: ...
|
||||
def assertDictContainsSubset(self,
|
||||
expected: Mapping[Any, Any],
|
||||
actual: Mapping[Any, Any],
|
||||
msg: object = ...) -> None: ...
|
||||
def addTypeEqualityFunc(self, typeobj: type, function: Callable[..., None]) -> None: ...
|
||||
@overload
|
||||
def failUnlessRaises(self, exception: _ExceptionType, callable: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ def quote_plus(s: AnyStr, safe: Text = ...) -> AnyStr: ...
|
||||
def urlencode(query: Union[Sequence[Tuple[Any, Any]], Mapping[Any, Any]], doseq=...) -> str: ...
|
||||
|
||||
def getproxies() -> Mapping[str, str]: ...
|
||||
def proxy_bypass(host): ...
|
||||
def proxy_bypass(host: str) -> Any: ... # Undocumented
|
||||
|
||||
# Names in __all__ with no definition:
|
||||
# basejoin
|
||||
|
||||
+21
-25
@@ -1,6 +1,6 @@
|
||||
# Stubs for urlparse (Python 2)
|
||||
|
||||
from typing import AnyStr, Dict, List, NamedTuple, Tuple, Sequence, Union, overload
|
||||
from typing import AnyStr, Dict, List, NamedTuple, Tuple, Sequence, Union, overload, Optional
|
||||
|
||||
_String = Union[str, unicode]
|
||||
|
||||
@@ -11,41 +11,37 @@ non_hierarchical: List[str]
|
||||
uses_query: List[str]
|
||||
uses_fragment: List[str]
|
||||
scheme_chars: str
|
||||
MAX_CACHE_SIZE = 0
|
||||
MAX_CACHE_SIZE: int
|
||||
|
||||
def clear_cache() -> None: ...
|
||||
|
||||
class ResultMixin(object):
|
||||
@property
|
||||
def username(self) -> str: ...
|
||||
def username(self) -> Optional[str]: ...
|
||||
@property
|
||||
def password(self) -> str: ...
|
||||
def password(self) -> Optional[str]: ...
|
||||
@property
|
||||
def hostname(self) -> str: ...
|
||||
def hostname(self) -> Optional[str]: ...
|
||||
@property
|
||||
def port(self) -> int: ...
|
||||
def port(self) -> Optional[int]: ...
|
||||
|
||||
class SplitResult(
|
||||
NamedTuple(
|
||||
'SplitResult',
|
||||
[
|
||||
('scheme', str), ('netloc', str), ('path', str), ('query', str), ('fragment', str)
|
||||
]
|
||||
),
|
||||
ResultMixin
|
||||
):
|
||||
class _SplitResult(NamedTuple):
|
||||
scheme: str
|
||||
netloc: str
|
||||
path: str
|
||||
query: str
|
||||
fragment: str
|
||||
class SplitResult(_SplitResult, ResultMixin):
|
||||
def geturl(self) -> str: ...
|
||||
|
||||
class ParseResult(
|
||||
NamedTuple(
|
||||
'ParseResult',
|
||||
[
|
||||
('scheme', str), ('netloc', str), ('path', str), ('params', str), ('query', str),
|
||||
('fragment', str)
|
||||
]
|
||||
),
|
||||
ResultMixin
|
||||
):
|
||||
class _ParseResult(NamedTuple):
|
||||
scheme: str
|
||||
netloc: str
|
||||
path: str
|
||||
params: str
|
||||
query: str
|
||||
fragment: str
|
||||
class ParseResult(_ParseResult, ResultMixin):
|
||||
def geturl(self) -> str: ...
|
||||
|
||||
def urlparse(url: _String, scheme: _String = ...,
|
||||
|
||||
+52
-20
@@ -12,7 +12,7 @@ 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]
|
||||
_dateTimeComp = Union[unicode, DateTime, datetime]
|
||||
# A "host description" used by Transport factories
|
||||
_hostDesc = Union[str, Tuple[str, Mapping[Any, Any]]]
|
||||
|
||||
@@ -55,26 +55,26 @@ Boolean: Type[bool]
|
||||
class DateTime:
|
||||
value: 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 make_comparable(self, other: _dateTimeComp) -> Tuple[unicode, unicode]: ...
|
||||
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 __eq__(self, other: _dateTimeComp) -> bool: ... # type: ignore
|
||||
def __ne__(self, other: _dateTimeComp) -> bool: ... # type: ignore
|
||||
def timetuple(self) -> struct_time: ...
|
||||
def __cmp__(self, other: _dateTimeComp) -> int: ...
|
||||
def decode(self, data: Any) -> None: ...
|
||||
def encode(self, out: IO) -> None: ...
|
||||
def encode(self, out: IO[str]) -> None: ...
|
||||
|
||||
class Binary:
|
||||
data: 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: ...
|
||||
def encode(self, out: IO[str]) -> None: ...
|
||||
|
||||
WRAPPERS: tuple
|
||||
WRAPPERS: Tuple[Type[Any], ...]
|
||||
|
||||
# Still part of the public API, but see http://bugs.python.org/issue1773632
|
||||
FastParser: None
|
||||
@@ -104,7 +104,28 @@ class Marshaller:
|
||||
allow_none: bool
|
||||
def __init__(self, encoding: Optional[str] = ..., allow_none: bool = ...) -> None: ...
|
||||
dispatch: 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 dumps(
|
||||
self,
|
||||
values: Union[
|
||||
Iterable[
|
||||
Union[
|
||||
None,
|
||||
int,
|
||||
bool,
|
||||
long,
|
||||
float,
|
||||
str,
|
||||
unicode,
|
||||
List[Any],
|
||||
Tuple[Any, ...],
|
||||
Mapping[Any, Any],
|
||||
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: ...
|
||||
@@ -112,15 +133,20 @@ class Marshaller:
|
||||
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_array(self, value: Iterable[Any], write: Callable[[str], None]) -> None: ...
|
||||
def dump_struct(
|
||||
self,
|
||||
value: Mapping[unicode, Any],
|
||||
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 close(self) -> Tuple[Any, ...]: ...
|
||||
def getmethodname(self) -> Optional[str]: ...
|
||||
def xml(self, encoding: str, standalone: bool) -> None: ...
|
||||
def start(self, tag: str, attrs: Any) -> None: ...
|
||||
@@ -143,9 +169,9 @@ class Unmarshaller:
|
||||
def end_methodName(self, data: str) -> None: ...
|
||||
|
||||
class _MultiCallMethod:
|
||||
def __init__(self, call_list: List[Tuple[str, tuple]], name: str) -> None: ...
|
||||
def __init__(self, call_list: List[Tuple[str, Tuple[Any, ...]]], name: str) -> None: ...
|
||||
class MultiCallIterator:
|
||||
def __init__(self, results: List) -> None: ...
|
||||
def __init__(self, results: List[Any]) -> None: ...
|
||||
|
||||
class MultiCall:
|
||||
def __init__(self, server: ServerProxy) -> None: ...
|
||||
@@ -153,19 +179,25 @@ class MultiCall:
|
||||
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 dumps(
|
||||
params: Union[Tuple[Any, ...], Fault],
|
||||
methodname: Optional[str] = ...,
|
||||
methodresponse: Optional[bool] = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
allow_none: bool = ...,
|
||||
) -> str: ...
|
||||
def loads(data: str, use_datetime: bool = ...) -> Tuple[Tuple[Any, ...], Optional[str]]: ...
|
||||
|
||||
def gzip_encode(data: str) -> str: ...
|
||||
def gzip_decode(data: str, max_decode: int = ...) -> str: ...
|
||||
|
||||
class GzipDecodedResponse(GzipFile):
|
||||
stringio: StringIO
|
||||
stringio: StringIO[Any]
|
||||
def __init__(self, response: HTTPResponse) -> None: ...
|
||||
def close(self): ...
|
||||
|
||||
class _Method:
|
||||
def __init__(self, send: Callable[[str, tuple], Any], name: str) -> None: ...
|
||||
def __init__(self, send: Callable[[str, Tuple[Any, ...]], Any], name: str) -> None: ...
|
||||
def __getattr__(self, name: str) -> _Method: ...
|
||||
def __call__(self, *args: Any) -> Any: ...
|
||||
|
||||
@@ -174,9 +206,9 @@ class Transport:
|
||||
accept_gzip_encoding: bool
|
||||
encode_threshold: Optional[int]
|
||||
def __init__(self, use_datetime: bool = ...) -> None: ...
|
||||
def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
|
||||
def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ...
|
||||
verbose: bool
|
||||
def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
|
||||
def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ...
|
||||
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: ...
|
||||
@@ -185,7 +217,7 @@ class Transport:
|
||||
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: ...
|
||||
def parse_response(self, response: HTTPResponse) -> Tuple[Any, ...]: ...
|
||||
|
||||
class SafeTransport(Transport):
|
||||
def __init__(self, use_datetime: bool = ..., context: Optional[SSLContext] = ...) -> None: ...
|
||||
|
||||
@@ -4,6 +4,7 @@ from typing import List
|
||||
class _Feature:
|
||||
def getOptionalRelease(self) -> sys._version_info: ...
|
||||
def getMandatoryRelease(self) -> sys._version_info: ...
|
||||
compiler_flag: int
|
||||
|
||||
absolute_import: _Feature
|
||||
division: _Feature
|
||||
@@ -21,4 +22,4 @@ if sys.version_info >= (3, 5):
|
||||
if sys.version_info >= (3, 7):
|
||||
annotations: _Feature
|
||||
|
||||
all_feature_names: List[str]
|
||||
all_feature_names: List[str] # undocumented
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"""Stub file for the '_bisect' module."""
|
||||
|
||||
from typing import Sequence, TypeVar
|
||||
from typing import Sequence, MutableSequence, TypeVar
|
||||
|
||||
_T = TypeVar('_T')
|
||||
def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
def insort_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
def insort_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
def insort(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
|
||||
@@ -43,8 +43,9 @@ def raw_unicode_escape_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[
|
||||
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]: ...
|
||||
if sys.version_info < (3, 8):
|
||||
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]: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from typing import Any, BinaryIO, IO, Optional, Tuple, Union, overload
|
||||
import sys
|
||||
from typing import Any, BinaryIO, IO, NamedTuple, Optional, Tuple, Union, overload
|
||||
|
||||
_chtype = Union[str, bytes, int]
|
||||
|
||||
@@ -12,6 +13,8 @@ A_COLOR: int
|
||||
A_DIM: int
|
||||
A_HORIZONTAL: int
|
||||
A_INVIS: int
|
||||
if sys.version_info >= (3, 7):
|
||||
A_ITALIC: int
|
||||
A_LEFT: int
|
||||
A_LOW: int
|
||||
A_NORMAL: int
|
||||
@@ -283,17 +286,20 @@ def tigetstr(capname: str) -> bytes: ...
|
||||
def tparm(fmt: bytes, i1: int = ..., i2: int = ..., i3: int = ..., i4: int = ..., i5: int = ..., i6: int = ..., i7: int = ..., i8: int = ..., i9: int = ...) -> bytes: ...
|
||||
def typeahead(fd: int) -> None: ...
|
||||
def unctrl(ch: _chtype) -> bytes: ...
|
||||
def unget_wch(ch: _chtype) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def unget_wch(ch: Union[int, str]) -> None: ...
|
||||
def ungetch(ch: _chtype) -> None: ...
|
||||
def ungetmouse(id: int, x: int, y: int, z: int, bstate: int) -> None: ...
|
||||
def update_lines_cols() -> int: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def update_lines_cols() -> int: ...
|
||||
def use_default_colors() -> None: ...
|
||||
def use_env(flag: bool) -> None: ...
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
class _CursesWindow:
|
||||
encoding: str
|
||||
if sys.version_info >= (3, 3):
|
||||
encoding: str
|
||||
@overload
|
||||
def addch(self, ch: _chtype, attr: int = ...) -> None: ...
|
||||
@overload
|
||||
@@ -344,13 +350,14 @@ class _CursesWindow:
|
||||
def getbegyx(self) -> Tuple[int, int]: ...
|
||||
def getbkgd(self) -> Tuple[int, int]: ...
|
||||
@overload
|
||||
def getch(self) -> _chtype: ...
|
||||
def getch(self) -> int: ...
|
||||
@overload
|
||||
def getch(self, y: int, x: int) -> _chtype: ...
|
||||
@overload
|
||||
def get_wch(self) -> _chtype: ...
|
||||
@overload
|
||||
def get_wch(self, y: int, x: int) -> _chtype: ...
|
||||
def getch(self, y: int, x: int) -> int: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
@overload
|
||||
def get_wch(self) -> Union[int, str]: ...
|
||||
@overload
|
||||
def get_wch(self, y: int, x: int) -> Union[int, str]: ...
|
||||
@overload
|
||||
def getkey(self) -> str: ...
|
||||
@overload
|
||||
@@ -445,3 +452,10 @@ class _CursesWindow:
|
||||
def vline(self, ch: _chtype, n: int) -> None: ...
|
||||
@overload
|
||||
def vline(self, y: int, x: int, ch: _chtype, n: int) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
class _ncurses_version(NamedTuple):
|
||||
major: int
|
||||
minor: int
|
||||
patch: int
|
||||
ncurses_version: _ncurses_version
|
||||
@@ -1,15 +1,15 @@
|
||||
"""Stub file for the '_heapq' module."""
|
||||
|
||||
from typing import TypeVar, List
|
||||
from typing import TypeVar, List, Iterable, Any, Callable, Optional
|
||||
import sys
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def heapify(heap: List[_T]) -> None: ...
|
||||
def heappop(heap: List[_T]) -> _T:
|
||||
raise IndexError() # if list is empty
|
||||
def heappop(heap: List[_T]) -> _T: ...
|
||||
def heappush(heap: List[_T], item: _T) -> None: ...
|
||||
def heappushpop(heap: List[_T], item: _T) -> _T: ...
|
||||
def heapreplace(heap: List[_T], item: _T) -> _T:
|
||||
raise IndexError() # if list is empty
|
||||
def nlargest(a: int, b: List[_T]) -> List[_T]: ...
|
||||
def nsmallest(a: int, b: List[_T]) -> List[_T]: ...
|
||||
def heapreplace(heap: List[_T], item: _T) -> _T: ...
|
||||
if sys.version_info < (3,):
|
||||
def nlargest(n: int, iterable: Iterable[_T]) -> List[_T]: ...
|
||||
def nsmallest(n: int, iterable: Iterable[_T]) -> List[_T]: ...
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import sys
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union, overload
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
_defaultaction: str
|
||||
_onceregistry: Dict[Any, Any]
|
||||
else:
|
||||
default_action: str
|
||||
once_registry: Dict[Any, Any]
|
||||
filters: List[Tuple[Any, ...]]
|
||||
@overload
|
||||
def warn(message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ...
|
||||
@overload
|
||||
def warn(message: Warning, category: Any = ..., stacklevel: int = ...) -> None: ...
|
||||
@overload
|
||||
def warn_explicit(
|
||||
message: str,
|
||||
category: Type[Warning],
|
||||
filename: str,
|
||||
lineno: int,
|
||||
module: Optional[str] = ...,
|
||||
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
|
||||
module_globals: Optional[Dict[str, Any]] = ...,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def warn_explicit(
|
||||
message: Warning,
|
||||
category: Any,
|
||||
filename: str,
|
||||
lineno: int,
|
||||
module: Optional[str] = ...,
|
||||
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
|
||||
module_globals: Optional[Dict[str, Any]] = ...,
|
||||
) -> None: ...
|
||||
@@ -2,7 +2,7 @@ from typing import Iterator, Any, Iterable, MutableSet, Optional, TypeVar, Gener
|
||||
|
||||
_S = TypeVar('_S')
|
||||
_T = TypeVar('_T')
|
||||
_SelfT = TypeVar('_SelfT', bound=WeakSet)
|
||||
_SelfT = TypeVar('_SelfT', bound=WeakSet[Any])
|
||||
|
||||
class WeakSet(MutableSet[_T], Generic[_T]):
|
||||
def __init__(self, data: Optional[Iterable[_T]] = ...) -> None: ...
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
from typing import Union, IO, Optional, Type, NamedTuple, List, Tuple, Any, Text, overload
|
||||
from typing_extensions import Literal
|
||||
from types import TracebackType
|
||||
import sys
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
class _aifc_params(NamedTuple):
|
||||
nchannels: int
|
||||
sampwidth: int
|
||||
framerate: int
|
||||
nframes: int
|
||||
comptype: bytes
|
||||
compname: bytes
|
||||
|
||||
_File = Union[Text, IO[bytes]]
|
||||
_Marker = Tuple[int, int, bytes]
|
||||
|
||||
class Aifc_read:
|
||||
def __init__(self, f: _File) -> None: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
def __enter__(self) -> Aifc_read: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException],
|
||||
exc_tb: Optional[TracebackType]) -> None: ...
|
||||
def initfp(self, file: IO[bytes]) -> None: ...
|
||||
def getfp(self) -> IO[bytes]: ...
|
||||
def rewind(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def tell(self) -> int: ...
|
||||
def getnchannels(self) -> int: ...
|
||||
def getnframes(self) -> int: ...
|
||||
def getsampwidth(self) -> int: ...
|
||||
def getframerate(self) -> int: ...
|
||||
def getcomptype(self) -> bytes: ...
|
||||
def getcompname(self) -> bytes: ...
|
||||
def getparams(self) -> _aifc_params: ...
|
||||
def getmarkers(self) -> Optional[List[_Marker]]: ...
|
||||
def getmark(self, id: int) -> _Marker: ...
|
||||
def setpos(self, pos: int) -> None: ...
|
||||
def readframes(self, nframes: int) -> bytes: ...
|
||||
|
||||
class Aifc_write:
|
||||
def __init__(self, f: _File) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
def __enter__(self) -> Aifc_write: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException],
|
||||
exc_tb: Optional[TracebackType]) -> None: ...
|
||||
def initfp(self, file: IO[bytes]) -> None: ...
|
||||
def aiff(self) -> None: ...
|
||||
def aifc(self) -> None: ...
|
||||
def setnchannels(self, nchannels: int) -> None: ...
|
||||
def getnchannels(self) -> int: ...
|
||||
def setsampwidth(self, sampwidth: int) -> None: ...
|
||||
def getsampwidth(self) -> int: ...
|
||||
def setframerate(self, framerate: int) -> None: ...
|
||||
def getframerate(self) -> int: ...
|
||||
def setnframes(self, nframes: int) -> None: ...
|
||||
def getnframes(self) -> int: ...
|
||||
def setcomptype(self, comptype: bytes, compname: bytes) -> None: ...
|
||||
def getcomptype(self) -> bytes: ...
|
||||
def getcompname(self) -> bytes: ...
|
||||
def setparams(self, params: Tuple[int, int, int, int, bytes, bytes]) -> None: ...
|
||||
def getparams(self) -> _aifc_params: ...
|
||||
def setmark(self, id: int, pos: int, name: bytes) -> None: ...
|
||||
def getmark(self, id: int) -> _Marker: ...
|
||||
def getmarkers(self) -> Optional[List[_Marker]]: ...
|
||||
def tell(self) -> int: ...
|
||||
def writeframesraw(self, data: Any) -> None: ... # Actual type for data is Buffer Protocol
|
||||
def writeframes(self, data: Any) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def open(f: _File, mode: Literal["r", "rb"] = ...) -> Aifc_read: ...
|
||||
@overload
|
||||
def open(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ...
|
||||
@overload
|
||||
def open(f: _File, mode: str) -> Any: ...
|
||||
|
||||
@overload
|
||||
def openfp(f: _File, mode: Literal["r", "rb"] = ...) -> Aifc_read: ...
|
||||
@overload
|
||||
def openfp(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ...
|
||||
@overload
|
||||
def openfp(f: _File, mode: str) -> Any: ...
|
||||
+124
-130
@@ -1,13 +1,11 @@
|
||||
# Stubs for argparse (Python 2.7 and 3.4)
|
||||
|
||||
from typing import (
|
||||
Any, Callable, Dict, Generator, Iterable, List, IO, NoReturn, Optional,
|
||||
Pattern, Sequence, Tuple, Type, Union, TypeVar, overload
|
||||
Pattern, Sequence, Text, Tuple, Type, Union, TypeVar, overload
|
||||
)
|
||||
import sys
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_ActionT = TypeVar('_ActionT', bound='Action')
|
||||
_ActionT = TypeVar('_ActionT', bound=Action)
|
||||
_N = TypeVar('_N')
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
@@ -46,38 +44,38 @@ class _ActionsContainer:
|
||||
_negative_number_matcher: Pattern[str]
|
||||
_has_negative_number_optionals: List[bool]
|
||||
|
||||
def __init__(self, description: Optional[_Text], prefix_chars: _Text,
|
||||
argument_default: Optional[_Text], conflict_handler: _Text) -> None: ...
|
||||
def register(self, registry_name: _Text, value: Any, object: Any) -> None: ...
|
||||
def _registry_get(self, registry_name: _Text, value: Any, default: Any = ...) -> Any: ...
|
||||
def __init__(self, description: Optional[Text], prefix_chars: Text,
|
||||
argument_default: Optional[Text], conflict_handler: Text) -> None: ...
|
||||
def register(self, registry_name: Text, value: Any, object: Any) -> None: ...
|
||||
def _registry_get(self, registry_name: Text, value: Any, default: Any = ...) -> Any: ...
|
||||
def set_defaults(self, **kwargs: Any) -> None: ...
|
||||
def get_default(self, dest: _Text) -> Any: ...
|
||||
def get_default(self, dest: Text) -> Any: ...
|
||||
def add_argument(self,
|
||||
*name_or_flags: _Text,
|
||||
action: Union[_Text, Type[Action]] = ...,
|
||||
nargs: Union[int, _Text] = ...,
|
||||
*name_or_flags: Text,
|
||||
action: Union[Text, Type[Action]] = ...,
|
||||
nargs: Union[int, Text] = ...,
|
||||
const: Any = ...,
|
||||
default: Any = ...,
|
||||
type: Union[Callable[[str], _T], FileType] = ...,
|
||||
type: Union[Callable[[Text], _T], Callable[[str], _T], FileType] = ...,
|
||||
choices: Iterable[_T] = ...,
|
||||
required: bool = ...,
|
||||
help: Optional[_Text] = ...,
|
||||
metavar: Optional[Union[_Text, Tuple[_Text, ...]]] = ...,
|
||||
dest: Optional[_Text] = ...,
|
||||
version: _Text = ...,
|
||||
help: Optional[Text] = ...,
|
||||
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
|
||||
dest: Optional[Text] = ...,
|
||||
version: Text = ...,
|
||||
**kwargs: Any) -> Action: ...
|
||||
def add_argument_group(self, *args: Any, **kwargs: Any) -> _ArgumentGroup: ...
|
||||
def add_mutually_exclusive_group(self, **kwargs: Any) -> _MutuallyExclusiveGroup: ...
|
||||
def _add_action(self, action: _ActionT) -> _ActionT: ...
|
||||
def _remove_action(self, action: Action) -> None: ...
|
||||
def _add_container_actions(self, container: _ActionsContainer) -> None: ...
|
||||
def _get_positional_kwargs(self, dest: _Text, **kwargs: Any) -> Dict[str, Any]: ...
|
||||
def _get_positional_kwargs(self, dest: Text, **kwargs: Any) -> Dict[str, Any]: ...
|
||||
def _get_optional_kwargs(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ...
|
||||
def _pop_action_class(self, kwargs: Any, default: Optional[Type[Action]] = ...) -> Type[Action]: ...
|
||||
def _get_handler(self) -> Callable[[Action, Iterable[Tuple[_Text, Action]]], Any]: ...
|
||||
def _get_handler(self) -> Callable[[Action, Iterable[Tuple[Text, Action]]], Any]: ...
|
||||
def _check_conflict(self, action: Action) -> None: ...
|
||||
def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[Tuple[_Text, Action]]) -> NoReturn: ...
|
||||
def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[Tuple[_Text, Action]]) -> None: ...
|
||||
def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[Tuple[Text, Action]]) -> NoReturn: ...
|
||||
def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[Tuple[Text, Action]]) -> None: ...
|
||||
|
||||
class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
prog: _Text
|
||||
@@ -103,88 +101,88 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
epilog: Optional[str] = ...,
|
||||
parents: Sequence[ArgumentParser] = ...,
|
||||
formatter_class: Type[HelpFormatter] = ...,
|
||||
prefix_chars: _Text = ...,
|
||||
prefix_chars: str = ...,
|
||||
fromfile_prefix_chars: Optional[str] = ...,
|
||||
argument_default: Optional[str] = ...,
|
||||
conflict_handler: _Text = ...,
|
||||
conflict_handler: str = ...,
|
||||
add_help: bool = ...,
|
||||
allow_abbrev: bool = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self,
|
||||
prog: Optional[_Text] = ...,
|
||||
usage: Optional[_Text] = ...,
|
||||
description: Optional[_Text] = ...,
|
||||
epilog: Optional[_Text] = ...,
|
||||
prog: Optional[Text] = ...,
|
||||
usage: Optional[Text] = ...,
|
||||
description: Optional[Text] = ...,
|
||||
epilog: Optional[Text] = ...,
|
||||
parents: Sequence[ArgumentParser] = ...,
|
||||
formatter_class: Type[HelpFormatter] = ...,
|
||||
prefix_chars: _Text = ...,
|
||||
fromfile_prefix_chars: Optional[_Text] = ...,
|
||||
argument_default: Optional[_Text] = ...,
|
||||
conflict_handler: _Text = ...,
|
||||
prefix_chars: Text = ...,
|
||||
fromfile_prefix_chars: Optional[Text] = ...,
|
||||
argument_default: Optional[Text] = ...,
|
||||
conflict_handler: Text = ...,
|
||||
add_help: bool = ...) -> None: ...
|
||||
|
||||
# The type-ignores in these overloads should be temporary. See:
|
||||
# https://github.com/python/typeshed/pull/2643#issuecomment-442280277
|
||||
@overload
|
||||
def parse_args(self, args: Optional[Sequence[_Text]] = ...) -> Namespace: ...
|
||||
def parse_args(self, args: Optional[Sequence[Text]] = ...) -> Namespace: ...
|
||||
@overload
|
||||
def parse_args(self, args: Optional[Sequence[_Text]], namespace: None) -> Namespace: ... # type: ignore
|
||||
def parse_args(self, args: Optional[Sequence[Text]], namespace: None) -> Namespace: ... # type: ignore
|
||||
@overload
|
||||
def parse_args(self, args: Optional[Sequence[_Text]], namespace: _N) -> _N: ...
|
||||
def parse_args(self, args: Optional[Sequence[Text]], namespace: _N) -> _N: ...
|
||||
@overload
|
||||
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore
|
||||
@overload
|
||||
def parse_args(self, *, namespace: _N) -> _N: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def add_subparsers(self, title: _Text = ...,
|
||||
description: Optional[_Text] = ...,
|
||||
prog: _Text = ...,
|
||||
def add_subparsers(self, title: str = ...,
|
||||
description: Optional[str] = ...,
|
||||
prog: str = ...,
|
||||
parser_class: Type[ArgumentParser] = ...,
|
||||
action: Type[Action] = ...,
|
||||
option_string: _Text = ...,
|
||||
dest: Optional[_Text] = ...,
|
||||
option_string: str = ...,
|
||||
dest: Optional[str] = ...,
|
||||
required: bool = ...,
|
||||
help: Optional[_Text] = ...,
|
||||
metavar: Optional[_Text] = ...) -> _SubParsersAction: ...
|
||||
help: Optional[str] = ...,
|
||||
metavar: Optional[str] = ...) -> _SubParsersAction: ...
|
||||
else:
|
||||
def add_subparsers(self, title: _Text = ...,
|
||||
description: Optional[_Text] = ...,
|
||||
prog: _Text = ...,
|
||||
def add_subparsers(self, title: Text = ...,
|
||||
description: Optional[Text] = ...,
|
||||
prog: Text = ...,
|
||||
parser_class: Type[ArgumentParser] = ...,
|
||||
action: Type[Action] = ...,
|
||||
option_string: _Text = ...,
|
||||
dest: Optional[_Text] = ...,
|
||||
help: Optional[_Text] = ...,
|
||||
metavar: Optional[_Text] = ...) -> _SubParsersAction: ...
|
||||
option_string: Text = ...,
|
||||
dest: Optional[Text] = ...,
|
||||
help: Optional[Text] = ...,
|
||||
metavar: Optional[Text] = ...) -> _SubParsersAction: ...
|
||||
|
||||
def print_usage(self, file: Optional[IO[str]] = ...) -> None: ...
|
||||
def print_help(self, file: Optional[IO[str]] = ...) -> None: ...
|
||||
def format_usage(self) -> str: ...
|
||||
def format_help(self) -> str: ...
|
||||
def parse_known_args(self, args: Optional[Sequence[_Text]] = ...,
|
||||
def parse_known_args(self, args: Optional[Sequence[Text]] = ...,
|
||||
namespace: Optional[Namespace] = ...) -> Tuple[Namespace, List[str]]: ...
|
||||
def convert_arg_line_to_args(self, arg_line: _Text) -> List[str]: ...
|
||||
def exit(self, status: int = ..., message: Optional[_Text] = ...) -> NoReturn: ...
|
||||
def error(self, message: _Text) -> NoReturn: ...
|
||||
def convert_arg_line_to_args(self, arg_line: Text) -> List[str]: ...
|
||||
def exit(self, status: int = ..., message: Optional[Text] = ...) -> NoReturn: ...
|
||||
def error(self, message: Text) -> NoReturn: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def parse_intermixed_args(self, args: Optional[Sequence[_Text]] = ...,
|
||||
def parse_intermixed_args(self, args: Optional[Sequence[str]] = ...,
|
||||
namespace: Optional[Namespace] = ...) -> Namespace: ...
|
||||
def parse_known_intermixed_args(self,
|
||||
args: Optional[Sequence[_Text]] = ...,
|
||||
args: Optional[Sequence[str]] = ...,
|
||||
namespace: Optional[Namespace] = ...) -> Tuple[Namespace, List[str]]: ...
|
||||
# undocumented
|
||||
def _get_optional_actions(self) -> List[Action]: ...
|
||||
def _get_positional_actions(self) -> List[Action]: ...
|
||||
def _parse_known_args(self, arg_strings: List[_Text], namespace: Namespace) -> Tuple[Namespace, List[str]]: ...
|
||||
def _read_args_from_files(self, arg_strings: List[_Text]) -> List[_Text]: ...
|
||||
def _match_argument(self, action: Action, arg_strings_pattern: _Text) -> int: ...
|
||||
def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: _Text) -> List[int]: ...
|
||||
def _parse_optional(self, arg_string: _Text) -> Optional[Tuple[Optional[Action], _Text, Optional[_Text]]]: ...
|
||||
def _get_option_tuples(self, option_string: _Text) -> List[Tuple[Action, _Text, Optional[_Text]]]: ...
|
||||
def _parse_known_args(self, arg_strings: List[Text], namespace: Namespace) -> Tuple[Namespace, List[str]]: ...
|
||||
def _read_args_from_files(self, arg_strings: List[Text]) -> List[Text]: ...
|
||||
def _match_argument(self, action: Action, arg_strings_pattern: Text) -> int: ...
|
||||
def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: Text) -> List[int]: ...
|
||||
def _parse_optional(self, arg_string: Text) -> Optional[Tuple[Optional[Action], Text, Optional[Text]]]: ...
|
||||
def _get_option_tuples(self, option_string: Text) -> List[Tuple[Action, Text, Optional[Text]]]: ...
|
||||
def _get_nargs_pattern(self, action: Action) -> _Text: ...
|
||||
def _get_values(self, action: Action, arg_strings: List[_Text]) -> Any: ...
|
||||
def _get_value(self, action: Action, arg_string: _Text) -> Any: ...
|
||||
def _get_values(self, action: Action, arg_strings: List[Text]) -> Any: ...
|
||||
def _get_value(self, action: Action, arg_string: Text) -> Any: ...
|
||||
def _check_value(self, action: Action, value: Any) -> None: ...
|
||||
def _get_formatter(self) -> HelpFormatter: ...
|
||||
def _print_message(self, message: str, file: Optional[IO[str]] = ...) -> None: ...
|
||||
@@ -203,31 +201,31 @@ class HelpFormatter:
|
||||
_whitespace_matcher: Pattern[str]
|
||||
_long_break_matcher: Pattern[str]
|
||||
_Section: Type[Any] # Nested class
|
||||
def __init__(self, prog: _Text, indent_increment: int = ...,
|
||||
def __init__(self, prog: Text, indent_increment: int = ...,
|
||||
max_help_position: int = ...,
|
||||
width: Optional[int] = ...) -> None: ...
|
||||
def _indent(self) -> None: ...
|
||||
def _dedent(self) -> None: ...
|
||||
def _add_item(self, func: Callable[..., _Text], args: Iterable[Any]) -> None: ...
|
||||
def start_section(self, heading: Optional[_Text]) -> None: ...
|
||||
def start_section(self, heading: Optional[Text]) -> None: ...
|
||||
def end_section(self) -> None: ...
|
||||
def add_text(self, text: Optional[_Text]) -> None: ...
|
||||
def add_usage(self, usage: _Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[_Text] = ...) -> None: ...
|
||||
def add_text(self, text: Optional[Text]) -> None: ...
|
||||
def add_usage(self, usage: Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[Text] = ...) -> None: ...
|
||||
def add_argument(self, action: Action) -> None: ...
|
||||
def add_arguments(self, actions: Iterable[Action]) -> None: ...
|
||||
def format_help(self) -> _Text: ...
|
||||
def _join_parts(self, part_strings: Iterable[_Text]) -> _Text: ...
|
||||
def _format_usage(self, usage: _Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[_Text]) -> _Text: ...
|
||||
def _join_parts(self, part_strings: Iterable[Text]) -> _Text: ...
|
||||
def _format_usage(self, usage: Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[Text]) -> _Text: ...
|
||||
def _format_actions_usage(self, actions: Iterable[Action], groups: Iterable[_ArgumentGroup]) -> _Text: ...
|
||||
def _format_text(self, text: _Text) -> _Text: ...
|
||||
def _format_text(self, text: Text) -> _Text: ...
|
||||
def _format_action(self, action: Action) -> _Text: ...
|
||||
def _format_action_invocation(self, action: Action) -> _Text: ...
|
||||
def _metavar_formatter(self, action: Action, default_metavar: _Text) -> Callable[[int], Tuple[_Text, ...]]: ...
|
||||
def _format_args(self, action: Action, default_metavar: _Text) -> _Text: ...
|
||||
def _metavar_formatter(self, action: Action, default_metavar: Text) -> Callable[[int], Tuple[_Text, ...]]: ...
|
||||
def _format_args(self, action: Action, default_metavar: Text) -> _Text: ...
|
||||
def _expand_help(self, action: Action) -> _Text: ...
|
||||
def _iter_indented_subactions(self, action: Action) -> Generator[Action, None, None]: ...
|
||||
def _split_lines(self, text: _Text, width: int) -> List[_Text]: ...
|
||||
def _fill_text(self, text: _Text, width: int, indent: int) -> _Text: ...
|
||||
def _split_lines(self, text: Text, width: int) -> List[_Text]: ...
|
||||
def _fill_text(self, text: Text, width: int, indent: Text) -> _Text: ...
|
||||
def _get_help_string(self, action: Action) -> Optional[_Text]: ...
|
||||
def _get_default_metavar_for_optional(self, action: Action) -> _Text: ...
|
||||
def _get_default_metavar_for_positional(self, action: Action) -> _Text: ...
|
||||
@@ -251,52 +249,48 @@ class Action(_AttributeHolder):
|
||||
metavar: Optional[Union[_Text, Tuple[_Text, ...]]]
|
||||
|
||||
def __init__(self,
|
||||
option_strings: Sequence[_Text],
|
||||
dest: _Text,
|
||||
nargs: Optional[Union[int, _Text]] = ...,
|
||||
option_strings: Sequence[Text],
|
||||
dest: Text,
|
||||
nargs: Optional[Union[int, Text]] = ...,
|
||||
const: Any = ...,
|
||||
default: Any = ...,
|
||||
type: Optional[Union[Callable[[str], _T], FileType]] = ...,
|
||||
type: Optional[Union[Callable[[Text], _T], Callable[[str], _T], FileType]] = ...,
|
||||
choices: Optional[Iterable[_T]] = ...,
|
||||
required: bool = ...,
|
||||
help: Optional[_Text] = ...,
|
||||
metavar: Optional[Union[_Text, Tuple[_Text, ...]]] = ...) -> None: ...
|
||||
help: Optional[Text] = ...,
|
||||
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ...
|
||||
def __call__(self, parser: ArgumentParser, namespace: Namespace,
|
||||
values: Union[_Text, Sequence[Any], None],
|
||||
option_string: Optional[_Text] = ...) -> None: ...
|
||||
values: Union[Text, Sequence[Any], None],
|
||||
option_string: Optional[Text] = ...) -> None: ...
|
||||
|
||||
class Namespace(_AttributeHolder):
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
def __getattr__(self, name: _Text) -> Any: ...
|
||||
def __setattr__(self, name: _Text, value: Any) -> None: ...
|
||||
def __getattr__(self, name: Text) -> Any: ...
|
||||
def __setattr__(self, name: Text, value: Any) -> None: ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
|
||||
class FileType:
|
||||
# undocumented
|
||||
_mode: _Text
|
||||
_bufsize: int
|
||||
if sys.version_info >= (3, 4):
|
||||
_encoding: Optional[_Text]
|
||||
_errors: Optional[_Text]
|
||||
if sys.version_info >= (3, 4):
|
||||
def __init__(self, mode: _Text = ..., bufsize: int = ...,
|
||||
encoding: Optional[_Text] = ...,
|
||||
errors: Optional[_Text] = ...) -> None: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def __init__(self,
|
||||
mode: _Text = ..., bufsize: int = ...) -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
_encoding: Optional[str]
|
||||
_errors: Optional[str]
|
||||
def __init__(self, mode: str = ..., bufsize: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self,
|
||||
mode: _Text = ..., bufsize: Optional[int] = ...) -> None: ...
|
||||
def __call__(self, string: _Text) -> IO[Any]: ...
|
||||
mode: Text = ..., bufsize: Optional[int] = ...) -> None: ...
|
||||
def __call__(self, string: Text) -> IO[Any]: ...
|
||||
|
||||
# undocumented
|
||||
class _ArgumentGroup(_ActionsContainer):
|
||||
title: Optional[_Text]
|
||||
_group_actions: List[Action]
|
||||
def __init__(self, container: _ActionsContainer,
|
||||
title: Optional[_Text] = ...,
|
||||
description: Optional[_Text] = ..., **kwargs: Any) -> None: ...
|
||||
title: Optional[Text] = ...,
|
||||
description: Optional[Text] = ..., **kwargs: Any) -> None: ...
|
||||
|
||||
# undocumented
|
||||
class _MutuallyExclusiveGroup(_ArgumentGroup):
|
||||
@@ -310,31 +304,31 @@ class _StoreAction(Action): ...
|
||||
# undocumented
|
||||
class _StoreConstAction(Action):
|
||||
def __init__(self,
|
||||
option_strings: Sequence[_Text],
|
||||
dest: _Text,
|
||||
option_strings: Sequence[Text],
|
||||
dest: Text,
|
||||
const: Any,
|
||||
default: Any = ...,
|
||||
required: bool = ...,
|
||||
help: Optional[_Text] = ...,
|
||||
metavar: Optional[Union[_Text, Tuple[_Text, ...]]] = ...) -> None: ...
|
||||
help: Optional[Text] = ...,
|
||||
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ...
|
||||
|
||||
# undocumented
|
||||
class _StoreTrueAction(_StoreConstAction):
|
||||
def __init__(self,
|
||||
option_strings: Sequence[_Text],
|
||||
dest: _Text,
|
||||
option_strings: Sequence[Text],
|
||||
dest: Text,
|
||||
default: bool = ...,
|
||||
required: bool = ...,
|
||||
help: Optional[_Text] = ...) -> None: ...
|
||||
help: Optional[Text] = ...) -> None: ...
|
||||
|
||||
# undocumented
|
||||
class _StoreFalseAction(_StoreConstAction):
|
||||
def __init__(self,
|
||||
option_strings: Sequence[_Text],
|
||||
dest: _Text,
|
||||
option_strings: Sequence[Text],
|
||||
dest: Text,
|
||||
default: bool = ...,
|
||||
required: bool = ...,
|
||||
help: Optional[_Text] = ...) -> None: ...
|
||||
help: Optional[Text] = ...) -> None: ...
|
||||
|
||||
# undocumented
|
||||
class _AppendAction(Action): ...
|
||||
@@ -342,40 +336,40 @@ class _AppendAction(Action): ...
|
||||
# undocumented
|
||||
class _AppendConstAction(Action):
|
||||
def __init__(self,
|
||||
option_strings: Sequence[_Text],
|
||||
dest: _Text,
|
||||
option_strings: Sequence[Text],
|
||||
dest: Text,
|
||||
const: Any,
|
||||
default: Any = ...,
|
||||
required: bool = ...,
|
||||
help: Optional[_Text] = ...,
|
||||
metavar: Optional[Union[_Text, Tuple[_Text, ...]]] = ...) -> None: ...
|
||||
help: Optional[Text] = ...,
|
||||
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ...
|
||||
|
||||
# undocumented
|
||||
class _CountAction(Action):
|
||||
def __init__(self,
|
||||
option_strings: Sequence[_Text],
|
||||
dest: _Text,
|
||||
option_strings: Sequence[Text],
|
||||
dest: Text,
|
||||
default: Any = ...,
|
||||
required: bool = ...,
|
||||
help: Optional[_Text] = ...) -> None: ...
|
||||
help: Optional[Text] = ...) -> None: ...
|
||||
|
||||
# undocumented
|
||||
class _HelpAction(Action):
|
||||
def __init__(self,
|
||||
option_strings: Sequence[_Text],
|
||||
dest: _Text = ...,
|
||||
default: _Text = ...,
|
||||
help: Optional[_Text] = ...) -> None: ...
|
||||
option_strings: Sequence[Text],
|
||||
dest: Text = ...,
|
||||
default: Text = ...,
|
||||
help: Optional[Text] = ...) -> None: ...
|
||||
|
||||
# undocumented
|
||||
class _VersionAction(Action):
|
||||
version: Optional[_Text]
|
||||
def __init__(self,
|
||||
option_strings: Sequence[_Text],
|
||||
version: Optional[_Text] = ...,
|
||||
dest: _Text = ...,
|
||||
default: _Text = ...,
|
||||
help: _Text = ...) -> None: ...
|
||||
option_strings: Sequence[Text],
|
||||
version: Optional[Text] = ...,
|
||||
dest: Text = ...,
|
||||
default: Text = ...,
|
||||
help: Text = ...) -> None: ...
|
||||
|
||||
# undocumented
|
||||
class _SubParsersAction(Action):
|
||||
@@ -386,15 +380,15 @@ class _SubParsersAction(Action):
|
||||
choices: Dict[_Text, ArgumentParser]
|
||||
_choices_actions: List[Action]
|
||||
def __init__(self,
|
||||
option_strings: Sequence[_Text],
|
||||
prog: _Text,
|
||||
option_strings: Sequence[Text],
|
||||
prog: Text,
|
||||
parser_class: Type[ArgumentParser],
|
||||
dest: _Text = ...,
|
||||
dest: Text = ...,
|
||||
required: bool = ...,
|
||||
help: Optional[_Text] = ...,
|
||||
metavar: Optional[Union[_Text, Tuple[_Text, ...]]] = ...) -> None: ...
|
||||
help: Optional[Text] = ...,
|
||||
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ...
|
||||
# TODO: Type keyword args properly.
|
||||
def add_parser(self, name: _Text, **kwargs: Any) -> ArgumentParser: ...
|
||||
def add_parser(self, name: Text, **kwargs: Any) -> ArgumentParser: ...
|
||||
def _get_subactions(self) -> List[Action]: ...
|
||||
|
||||
# undocumented
|
||||
@@ -402,7 +396,7 @@ class ArgumentTypeError(Exception): ...
|
||||
|
||||
if sys.version_info < (3, 7):
|
||||
# undocumented
|
||||
def _ensure_value(namespace: Namespace, name: _Text, value: Any) -> Any: ...
|
||||
def _ensure_value(namespace: Namespace, name: Text, value: Any) -> Any: ...
|
||||
|
||||
# undocumented
|
||||
def _get_action_name(argument: Optional[Action]) -> Optional[str]: ...
|
||||
|
||||
@@ -13,8 +13,9 @@ from errno import (EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL,
|
||||
EPIPE, EAGAIN, errorcode)
|
||||
|
||||
# cyclic dependence with asynchat
|
||||
_maptype = Dict[str, Any]
|
||||
_maptype = Dict[int, Any]
|
||||
|
||||
socket_map: _maptype = ... # Undocumented
|
||||
|
||||
class ExitNow(Exception): ...
|
||||
|
||||
@@ -50,8 +51,8 @@ class dispatcher:
|
||||
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 bind(self, address: Union[Tuple[Any, ...], str]) -> None: ...
|
||||
def connect(self, address: Union[Tuple[Any, ...], str]) -> None: ...
|
||||
def accept(self) -> Optional[Tuple[SocketType, Any]]: ...
|
||||
def send(self, data: bytes) -> int: ...
|
||||
def recv(self, buffer_size: int) -> bytes: ...
|
||||
@@ -103,7 +104,7 @@ class dispatcher:
|
||||
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 sendto(self, data: bytes, address: Union[Tuple[str, int], 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: ...
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
from typing import Any, Optional, Tuple
|
||||
|
||||
AdpcmState = Tuple[int, int]
|
||||
RatecvState = Tuple[int, Tuple[Tuple[int, int], ...]]
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
def add(fragment1: bytes, fragment2: bytes, width: int) -> bytes: ...
|
||||
def adpcm2lin(adpcmfragment: bytes, width: int, state: Optional[AdpcmState]) -> Tuple[bytes, AdpcmState]: ...
|
||||
def alaw2lin(fragment: bytes, width: int) -> bytes: ...
|
||||
def avg(fragment: bytes, width: int) -> int: ...
|
||||
def avgpp(fragment: bytes, width: int) -> int: ...
|
||||
def bias(fragment: bytes, width: int, bias: int) -> bytes: ...
|
||||
def byteswap(fragment: bytes, width: int) -> bytes: ...
|
||||
def cross(fragment: bytes, width: int) -> int: ...
|
||||
def findfactor(fragment: bytes, reference: bytes) -> float: ...
|
||||
def findfit(fragment: bytes, reference: bytes) -> Tuple[int, float]: ...
|
||||
def findmax(fragment: bytes, length: int) -> int: ...
|
||||
def getsample(fragment: bytes, width: int, index: int) -> int: ...
|
||||
def lin2adpcm(fragment: bytes, width: int, state: Optional[AdpcmState]) -> Tuple[bytes, AdpcmState]: ...
|
||||
def lin2alaw(fragment: bytes, width: int) -> bytes: ...
|
||||
def lin2lin(fragment: bytes, width: int, newwidth: int) -> bytes: ...
|
||||
def lin2ulaw(fragment: bytes, width: int) -> bytes: ...
|
||||
def max(fragment: bytes, width: int) -> int: ...
|
||||
def maxpp(fragment: bytes, width: int) -> int: ...
|
||||
def minmax(fragment: bytes, width: int) -> Tuple[int, int]: ...
|
||||
def mul(fragment: bytes, width: int, factor: float) -> bytes: ...
|
||||
def ratecv(
|
||||
fragment: bytes,
|
||||
width: int,
|
||||
nchannels: int,
|
||||
inrate: int,
|
||||
outrate: int,
|
||||
state: Optional[RatecvState],
|
||||
weightA: int = ...,
|
||||
weightB: int = ...,
|
||||
) -> Tuple[bytes, RatecvState]: ...
|
||||
def reverse(fragment: bytes, width: int) -> bytes: ...
|
||||
def rms(fragment: bytes, width: int) -> int: ...
|
||||
def tomono(fragment: bytes, width: int, lfactor: float, rfactor: float) -> bytes: ...
|
||||
def tostereo(fragment: bytes, width: int, lfactor: float, rfactor: float) -> bytes: ...
|
||||
def ulaw2lin(fragment: bytes, width: int) -> bytes: ...
|
||||
@@ -0,0 +1,94 @@
|
||||
|
||||
from typing import Set, Dict, Iterable, Any, Callable, Tuple, Type, SupportsInt, List, Union, TypeVar, Optional, IO
|
||||
from types import FrameType, TracebackType, CodeType
|
||||
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_TraceDispatch = Callable[[FrameType, str, Any], Any] # TODO: Recursive type
|
||||
_ExcInfo = Tuple[Type[BaseException], BaseException, FrameType]
|
||||
|
||||
GENERATOR_AND_COROUTINE_FLAGS: int = ...
|
||||
|
||||
class BdbQuit(Exception): ...
|
||||
|
||||
class Bdb:
|
||||
|
||||
skip: Optional[Set[str]]
|
||||
breaks: Dict[str, List[int]]
|
||||
fncache: Dict[str, str]
|
||||
frame_returning: Optional[FrameType]
|
||||
botframe: Optional[FrameType]
|
||||
quitting: bool
|
||||
stopframe: Optional[FrameType]
|
||||
returnframe: Optional[FrameType]
|
||||
stoplineno: int
|
||||
|
||||
def __init__(self, skip: Iterable[str] = ...) -> None: ...
|
||||
def canonic(self, filename: str) -> str: ...
|
||||
def reset(self) -> None: ...
|
||||
def trace_dispatch(self, frame: FrameType, event: str, arg: Any) -> _TraceDispatch: ...
|
||||
def dispatch_line(self, frame: FrameType) -> _TraceDispatch: ...
|
||||
def dispatch_call(self, frame: FrameType, arg: None) -> _TraceDispatch: ...
|
||||
def dispatch_return(self, frame: FrameType, arg: Any) -> _TraceDispatch: ...
|
||||
def dispatch_exception(self, frame: FrameType, arg: _ExcInfo) -> _TraceDispatch: ...
|
||||
def is_skipped_module(self, module_name: str) -> bool: ...
|
||||
def stop_here(self, frame: FrameType) -> bool: ...
|
||||
def break_here(self, frame: FrameType) -> bool: ...
|
||||
def do_clear(self, arg: Any) -> None: ...
|
||||
def break_anywhere(self, frame: FrameType) -> bool: ...
|
||||
def user_call(self, frame: FrameType, argument_list: None) -> None: ...
|
||||
def user_line(self, frame: FrameType) -> None: ...
|
||||
def user_return(self, frame: FrameType, return_value: Any) -> None: ...
|
||||
def user_exception(self, frame: FrameType, exc_info: _ExcInfo) -> None: ...
|
||||
def set_until(self, frame: FrameType, lineno: Optional[int] = ...) -> None: ...
|
||||
def set_step(self) -> None: ...
|
||||
def set_next(self, frame: FrameType) -> None: ...
|
||||
def set_return(self, frame: FrameType) -> None: ...
|
||||
def set_trace(self, frame: Optional[FrameType] = ...) -> None: ...
|
||||
def set_continue(self) -> None: ...
|
||||
def set_quit(self) -> None: ...
|
||||
def set_break(self, filename: str, lineno: int, temporary: bool = ..., cond: Optional[str] = ..., funcname: Optional[str] = ...) -> None: ...
|
||||
def clear_break(self, filename: str, lineno: int) -> None: ...
|
||||
def clear_bpbynumber(self, arg: SupportsInt) -> None: ...
|
||||
def clear_all_file_breaks(self, filename: str) -> None: ...
|
||||
def clear_all_breaks(self) -> None: ...
|
||||
def get_bpbynumber(self, arg: SupportsInt) -> Breakpoint: ...
|
||||
def get_break(self, filename: str, lineno: int) -> bool: ...
|
||||
def get_breaks(self, filename: str, lineno: int) -> List[Breakpoint]: ...
|
||||
def get_file_breaks(self, filename: str) -> List[Breakpoint]: ...
|
||||
def get_all_breaks(self) -> List[Breakpoint]: ...
|
||||
def get_stack(self, f: FrameType, t: TracebackType) -> Tuple[List[Tuple[FrameType, int]], int]: ...
|
||||
def format_stack_entry(self, frame_lineno: int, lprefix: str = ...) -> str: ...
|
||||
def run(self, cmd: Union[str, CodeType], globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> None: ...
|
||||
def runeval(self, expr: str, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> None: ...
|
||||
def runctx(self, cmd: Union[str, CodeType], globals: Dict[str, Any], locals: Dict[str, Any]) -> None: ...
|
||||
def runcall(self, func: Callable[[Any], _T], *args: Any, **kwds: Any) -> Optional[_T]: ...
|
||||
|
||||
class Breakpoint:
|
||||
|
||||
next: int = ...
|
||||
bplist: Dict[Tuple[str, int], List[Breakpoint]] = ...
|
||||
bpbynumber: List[Optional[Breakpoint]] = ...
|
||||
|
||||
funcname: Optional[str]
|
||||
func_first_executable_line: Optional[int]
|
||||
file: str
|
||||
line: int
|
||||
temporary: bool
|
||||
cond: Optional[str]
|
||||
enabled: bool
|
||||
ignore: int
|
||||
hits: int
|
||||
number: int
|
||||
|
||||
def __init__(self, file: str, line: int, temporary: bool = ..., cond: Optional[str] = ..., funcname: Optional[str] = ...) -> None: ...
|
||||
def deleteMe(self) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def bpprint(self, out: Optional[IO[str]] = ...) -> None: ...
|
||||
def bpformat(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
def checkfuncname(b: Breakpoint, frame: FrameType) -> bool: ...
|
||||
def effective(file: str, line: int, frame: FrameType) -> Union[Tuple[Breakpoint, bool], Tuple[None, None]]: ...
|
||||
def set_trace() -> None: ...
|
||||
@@ -5,20 +5,15 @@
|
||||
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
|
||||
_Bytes = Text
|
||||
_Ascii = Text
|
||||
else:
|
||||
# But since Python 3.3 ASCII-only unicode strings are accepted by the
|
||||
# a2b_* functions.
|
||||
_Bytes = bytes
|
||||
_Ascii = Union[bytes, Text]
|
||||
_Ascii = Union[bytes, str]
|
||||
|
||||
def a2b_uu(string: _Ascii) -> bytes: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
|
||||
+7
-16
@@ -1,22 +1,13 @@
|
||||
# Stubs for bisect
|
||||
|
||||
from typing import Any, Sequence, TypeVar
|
||||
from typing import Any, Sequence, MutableSequence, TypeVar
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
# TODO uncomment when mypy# 2035 is fixed
|
||||
# def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
# def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
# def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
#
|
||||
# def insort_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
# def insort_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
# def insort(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
|
||||
def bisect_left(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_right(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
|
||||
def insort_left(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort_right(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
|
||||
+87
-59
@@ -17,6 +17,11 @@ import sys
|
||||
if sys.version_info >= (3,):
|
||||
from typing import SupportsBytes, SupportsRound
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T_co = TypeVar('_T_co', covariant=True)
|
||||
_KT = TypeVar('_KT')
|
||||
@@ -29,6 +34,9 @@ _T4 = TypeVar('_T4')
|
||||
_T5 = TypeVar('_T5')
|
||||
_TT = TypeVar('_TT', bound='type')
|
||||
|
||||
class _SupportsIndex(Protocol):
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
class object:
|
||||
__doc__: Optional[str]
|
||||
__dict__: Dict[str, Any]
|
||||
@@ -53,30 +61,30 @@ class object:
|
||||
def __getattribute__(self, name: str) -> Any: ...
|
||||
def __delattr__(self, name: str) -> None: ...
|
||||
def __sizeof__(self) -> int: ...
|
||||
def __reduce__(self) -> tuple: ...
|
||||
def __reduce_ex__(self, protocol: int) -> tuple: ...
|
||||
def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ...
|
||||
def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ...
|
||||
if sys.version_info >= (3,):
|
||||
def __dir__(self) -> Iterable[str]: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def __init_subclass__(cls) -> None: ...
|
||||
|
||||
class staticmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable
|
||||
__func__: Callable[..., Any]
|
||||
if sys.version_info >= (3,):
|
||||
__isabstractmethod__: bool
|
||||
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __init__(self, f: Callable[..., Any]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
|
||||
|
||||
class classmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable
|
||||
__func__: Callable[..., Any]
|
||||
if sys.version_info >= (3,):
|
||||
__isabstractmethod__: bool
|
||||
|
||||
def __init__(self, f: Callable) -> None: ...
|
||||
def __init__(self, f: Callable[..., Any]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
|
||||
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
|
||||
|
||||
class type(object):
|
||||
__base__: type
|
||||
@@ -129,10 +137,12 @@ class super(object):
|
||||
|
||||
class int:
|
||||
@overload
|
||||
def __init__(self, x: Union[Text, bytes, SupportsInt] = ...) -> None: ...
|
||||
def __init__(self, x: Union[Text, bytes, SupportsInt, _SupportsIndex] = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, x: Union[Text, bytes, bytearray], base: int) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def as_integer_ratio(self) -> Tuple[int, Literal[1]]: ...
|
||||
@property
|
||||
def real(self) -> int: ...
|
||||
@property
|
||||
@@ -168,7 +178,7 @@ class int:
|
||||
def __rtruediv__(self, x: int) -> float: ...
|
||||
def __rmod__(self, x: int) -> int: ...
|
||||
def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
|
||||
def __pow__(self, x: int) -> Any: ... # Return type can be int or float, depending on x.
|
||||
def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ... # Return type can be int or float, depending on x.
|
||||
def __rpow__(self, x: int) -> Any: ...
|
||||
def __and__(self, n: int) -> int: ...
|
||||
def __or__(self, n: int) -> int: ...
|
||||
@@ -183,7 +193,10 @@ class int:
|
||||
def __neg__(self) -> int: ...
|
||||
def __pos__(self) -> int: ...
|
||||
def __invert__(self) -> int: ...
|
||||
def __trunc__(self) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
def __ceil__(self) -> int: ...
|
||||
def __floor__(self) -> int: ...
|
||||
def __round__(self, ndigits: Optional[int] = ...) -> int: ...
|
||||
def __getnewargs__(self) -> Tuple[int]: ...
|
||||
|
||||
@@ -206,7 +219,7 @@ class int:
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
class float:
|
||||
def __init__(self, x: Union[SupportsFloat, Text, bytes, bytearray] = ...) -> None: ...
|
||||
def __init__(self, x: Union[SupportsFloat, _SupportsIndex, Text, bytes, bytearray] = ...) -> None: ...
|
||||
def as_integer_ratio(self) -> Tuple[int, int]: ...
|
||||
def hex(self) -> str: ...
|
||||
def is_integer(self) -> bool: ...
|
||||
@@ -240,11 +253,10 @@ class float:
|
||||
def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
|
||||
def __rpow__(self, x: float) -> float: ...
|
||||
def __getnewargs__(self) -> Tuple[float]: ...
|
||||
def __trunc__(self) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
@overload
|
||||
def __round__(self) -> int: ...
|
||||
@overload
|
||||
def __round__(self, ndigits: None) -> int: ...
|
||||
def __round__(self, ndigits: None = ...) -> int: ...
|
||||
@overload
|
||||
def __round__(self, ndigits: int) -> float: ...
|
||||
|
||||
@@ -269,11 +281,9 @@ class float:
|
||||
|
||||
class complex:
|
||||
@overload
|
||||
def __init__(self, re: float = ..., im: float = ...) -> None: ...
|
||||
def __init__(self, real: float = ..., imag: float = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, s: str) -> None: ...
|
||||
@overload
|
||||
def __init__(self, s: SupportsComplex) -> None: ...
|
||||
def __init__(self, real: Union[str, SupportsComplex, _SupportsIndex]) -> None: ...
|
||||
|
||||
@property
|
||||
def real(self) -> float: ...
|
||||
@@ -332,7 +342,7 @@ else:
|
||||
end: int = ...) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> unicode: ...
|
||||
def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
|
||||
def format(self, *args: Any, **kwargs: Any) -> unicode: ...
|
||||
def format(self, *args: object, **kwargs: object) -> unicode: ...
|
||||
def index(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
|
||||
def isalnum(self) -> bool: ...
|
||||
def isalpha(self) -> bool: ...
|
||||
@@ -421,7 +431,7 @@ class str(Sequence[str], _str_base):
|
||||
def endswith(self, suffix: Union[Text, Tuple[Text, ...]]) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> str: ...
|
||||
def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
def format(self, *args: Any, **kwargs: Any) -> str: ...
|
||||
def format(self, *args: object, **kwargs: object) -> str: ...
|
||||
if sys.version_info >= (3,):
|
||||
def format_map(self, map: Mapping[str, Any]) -> str: ...
|
||||
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
|
||||
@@ -667,6 +677,8 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ...
|
||||
def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
|
||||
def expandtabs(self, tabsize: int = ...) -> bytearray: ...
|
||||
if sys.version_info < (3,):
|
||||
def extend(self, iterable: Union[str, Iterable[int]]) -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
@@ -734,7 +746,7 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def __repr__(self) -> str: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
__hash__: None # type: ignore
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
@overload
|
||||
@@ -784,9 +796,10 @@ class memoryview(Sized, Container[_mv_container_type]):
|
||||
c_contiguous: bool
|
||||
f_contiguous: bool
|
||||
contiguous: bool
|
||||
nbytes: int
|
||||
def __init__(self, obj: Union[bytes, bytearray, memoryview]) -> None: ...
|
||||
def __enter__(self) -> memoryview: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
|
||||
else:
|
||||
def __init__(self, obj: Union[bytes, bytearray, buffer, memoryview]) -> None: ...
|
||||
|
||||
@@ -799,16 +812,19 @@ class memoryview(Sized, Container[_mv_container_type]):
|
||||
def __iter__(self) -> Iterator[_mv_container_type]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: memoryview) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, i: int, o: bytes) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: memoryview) -> None: ...
|
||||
|
||||
def tobytes(self) -> bytes: ...
|
||||
def tolist(self) -> List[int]: ...
|
||||
|
||||
if sys.version_info >= (3, 2):
|
||||
def release(self) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
def hex(self) -> str: ...
|
||||
|
||||
@@ -841,13 +857,14 @@ class bool(int):
|
||||
def __getnewargs__(self) -> Tuple[int]: ...
|
||||
|
||||
class slice(object):
|
||||
start: Optional[int]
|
||||
step: Optional[int]
|
||||
stop: Optional[int]
|
||||
start: Any
|
||||
step: Any
|
||||
stop: Any
|
||||
@overload
|
||||
def __init__(self, stop: Optional[int]) -> None: ...
|
||||
def __init__(self, stop: Any) -> None: ...
|
||||
@overload
|
||||
def __init__(self, start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> None: ...
|
||||
def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ...
|
||||
__hash__: None # type: ignore
|
||||
def indices(self, len: int) -> Tuple[int, int, int]: ...
|
||||
|
||||
class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
@@ -863,7 +880,10 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
def __le__(self, x: Tuple[_T_co, ...]) -> bool: ...
|
||||
def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ...
|
||||
def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ...
|
||||
@overload
|
||||
def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
|
||||
@overload
|
||||
def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ...
|
||||
def __mul__(self, n: int) -> Tuple[_T_co, ...]: ...
|
||||
def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ...
|
||||
def count(self, x: Any) -> int: ...
|
||||
@@ -876,9 +896,9 @@ class function:
|
||||
# TODO not defined in builtins!
|
||||
__name__: str
|
||||
__module__: str
|
||||
__code__: CodeType
|
||||
if sys.version_info >= (3,):
|
||||
__qualname__: str
|
||||
__code__: CodeType
|
||||
__annotations__: Dict[str, Any]
|
||||
|
||||
class list(MutableSequence[_T], Generic[_T]):
|
||||
@@ -905,7 +925,7 @@ class list(MutableSequence[_T], Generic[_T]):
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __hash__(self) -> int: ...
|
||||
__hash__: None # type: ignore
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
@overload
|
||||
@@ -978,7 +998,10 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __setitem__(self, k: _KT, v: _VT) -> None: ...
|
||||
def __delitem__(self, v: _KT) -> None: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def __reversed__(self) -> Iterator[_KT]: ...
|
||||
def __str__(self) -> str: ...
|
||||
__hash__: None # type: ignore
|
||||
|
||||
class set(MutableSet[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
|
||||
@@ -1015,6 +1038,7 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
def __lt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __gt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
__hash__: None # type: ignore
|
||||
|
||||
class frozenset(AbstractSet[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
|
||||
@@ -1106,8 +1130,6 @@ if sys.version_info < (3,):
|
||||
if sys.version_info >= (3,):
|
||||
def ascii(__o: object) -> str: ...
|
||||
|
||||
class _SupportsIndex(Protocol):
|
||||
def __index__(self) -> int: ...
|
||||
def bin(__number: Union[int, _SupportsIndex]) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
@@ -1124,7 +1146,7 @@ if sys.version_info >= (3, 6):
|
||||
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
|
||||
class _PathLike(Generic[AnyStr]):
|
||||
def __fspath__(self) -> AnyStr: ...
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike[Any]], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
else:
|
||||
@@ -1149,20 +1171,15 @@ if sys.version_info >= (3,):
|
||||
def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
else:
|
||||
@overload
|
||||
def filter(__function: Callable[[AnyStr], Any], # type: ignore
|
||||
__iterable: AnyStr) -> AnyStr: ...
|
||||
def filter(__function: Callable[[AnyStr], Any], __iterable: AnyStr) -> AnyStr: ... # type: ignore
|
||||
@overload
|
||||
def filter(__function: None, # type: ignore
|
||||
__iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ...
|
||||
def filter(__function: None, __iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ... # type: ignore
|
||||
@overload
|
||||
def filter(__function: Callable[[_T], Any], # type: ignore
|
||||
__iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ...
|
||||
def filter(__function: Callable[[_T], Any], __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... # type: ignore
|
||||
@overload
|
||||
def filter(__function: None,
|
||||
__iterable: Iterable[Optional[_T]]) -> List[_T]: ...
|
||||
def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> List[_T]: ...
|
||||
@overload
|
||||
def filter(__function: Callable[[_T], Any],
|
||||
__iterable: Iterable[_T]) -> List[_T]: ...
|
||||
def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ...
|
||||
def format(__o: object, __format_spec: str = ...) -> str: ... # TODO unicode
|
||||
def getattr(__o: Any, name: Text, __default: Any = ...) -> Any: ...
|
||||
def globals() -> Dict[str, Any]: ...
|
||||
@@ -1180,9 +1197,11 @@ else:
|
||||
@overload
|
||||
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ...
|
||||
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
|
||||
def iter(__function: Callable[[], Optional[_T]], __sentinel: None) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ...
|
||||
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
|
||||
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
|
||||
def len(__o: Sized) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
def license() -> None: ...
|
||||
@@ -1318,7 +1337,7 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
|
||||
def oct(__i: Union[int, _SupportsIndex]) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
|
||||
def open(file: Union[str, bytes, int, _PathLike[Any]], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
|
||||
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...,
|
||||
opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ...
|
||||
elif sys.version_info >= (3,):
|
||||
@@ -1332,12 +1351,16 @@ def ord(__c: Union[Text, bytes]) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
class _Writer(Protocol):
|
||||
def write(self, __s: str) -> Any: ...
|
||||
def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ..., flush: bool = ...) -> None: ...
|
||||
def print(
|
||||
*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ..., flush: bool = ...
|
||||
) -> None: ...
|
||||
|
||||
else:
|
||||
class _Writer(Protocol):
|
||||
def write(self, __s: Any) -> Any: ...
|
||||
# This is only available after from __future__ import print_function.
|
||||
def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ...) -> None: ...
|
||||
def print(*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ...) -> None: ...
|
||||
|
||||
@overload
|
||||
def pow(__x: int, __y: int) -> Any: ... # The return type can be int or float, depending on y
|
||||
@overload
|
||||
@@ -1370,7 +1393,7 @@ if sys.version_info >= (3,):
|
||||
@overload
|
||||
def round(number: SupportsRound[_T]) -> int: ...
|
||||
@overload
|
||||
def round(number: SupportsRound[_T], ndigits: None) -> int: ... # type: ignore
|
||||
def round(number: SupportsRound[_T], ndigits: None) -> int: ...
|
||||
@overload
|
||||
def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
|
||||
else:
|
||||
@@ -1390,7 +1413,7 @@ if sys.version_info >= (3,):
|
||||
else:
|
||||
def sorted(__iterable: Iterable[_T], *,
|
||||
cmp: Callable[[_T, _T], int] = ...,
|
||||
key: Callable[[_T], Any] = ...,
|
||||
key: Optional[Callable[[_T], Any]] = ...,
|
||||
reverse: bool = ...) -> List[_T]: ...
|
||||
@overload
|
||||
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
|
||||
@@ -1436,8 +1459,10 @@ else:
|
||||
def zip(__iter1: Iterable[Any], __iter2: Iterable[Any], __iter3: Iterable[Any],
|
||||
__iter4: Iterable[Any], __iter5: Iterable[Any], __iter6: Iterable[Any],
|
||||
*iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ...
|
||||
def __import__(name: Text, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...,
|
||||
fromlist: List[str] = ..., level: int = ...) -> Any: ...
|
||||
def __import__(name: Text, globals: Optional[Mapping[str, Any]] = ...,
|
||||
locals: Optional[Mapping[str, Any]] = ...,
|
||||
fromlist: Sequence[str] = ...,
|
||||
level: int = ...) -> Any: ...
|
||||
|
||||
# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
|
||||
# not exposed anywhere under that name, we make it private here.
|
||||
@@ -1467,6 +1492,8 @@ class BaseException(object):
|
||||
__suppress_context__: bool
|
||||
__traceback__: Optional[TracebackType]
|
||||
def __init__(self, *args: object) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __repr__(self) -> str: ...
|
||||
if sys.version_info < (3,):
|
||||
def __getitem__(self, i: int) -> Any: ...
|
||||
def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ...
|
||||
@@ -1508,9 +1535,10 @@ class AttributeError(_StandardError): ...
|
||||
class BufferError(_StandardError): ...
|
||||
class EOFError(_StandardError): ...
|
||||
class ImportError(_StandardError):
|
||||
if sys.version_info >= (3,):
|
||||
name: str
|
||||
path: str
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, *args, name: Optional[str] = ..., path: Optional[str] = ...) -> None: ...
|
||||
name: Optional[str]
|
||||
path: Optional[str]
|
||||
class LookupError(_StandardError): ...
|
||||
class MemoryError(_StandardError): ...
|
||||
class NameError(_StandardError): ...
|
||||
@@ -1523,7 +1551,7 @@ class SyntaxError(_StandardError):
|
||||
msg: str
|
||||
lineno: int
|
||||
offset: Optional[int]
|
||||
text: str
|
||||
text: Optional[str]
|
||||
filename: str
|
||||
class SystemError(_StandardError): ...
|
||||
class TypeError(_StandardError): ...
|
||||
@@ -1612,7 +1640,7 @@ if sys.version_info < (3,):
|
||||
def next(self) -> str: ...
|
||||
def read(self, n: int = ...) -> str: ...
|
||||
def __enter__(self) -> BinaryIO: ...
|
||||
def __exit__(self, t: Optional[type] = ..., exc: Optional[BaseException] = ..., tb: Optional[Any] = ...) -> bool: ...
|
||||
def __exit__(self, t: Optional[type] = ..., exc: Optional[BaseException] = ..., tb: Optional[Any] = ...) -> Optional[bool]: ...
|
||||
def flush(self) -> None: ...
|
||||
def fileno(self) -> int: ...
|
||||
def isatty(self) -> bool: ...
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Any, Callable, Dict, Optional, Text, TypeVar, Union
|
||||
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
|
||||
def runctx(statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
|
||||
|
||||
_SelfT = TypeVar('_SelfT', bound='Profile')
|
||||
_SelfT = TypeVar('_SelfT', bound=Profile)
|
||||
_T = TypeVar('_T')
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[bytes, Text, os.PathLike[Any]]
|
||||
@@ -22,3 +22,6 @@ class Profile:
|
||||
def run(self: _SelfT, cmd: str) -> _SelfT: ...
|
||||
def runctx(self: _SelfT, cmd: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> _SelfT: ...
|
||||
def runcall(self, func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def __enter__(self: _SelfT) -> _SelfT: ...
|
||||
def __exit__(self, *exc_info: Any) -> None: ...
|
||||
|
||||
@@ -5,8 +5,9 @@ _T = TypeVar('_T', bound=FieldStorage)
|
||||
|
||||
def parse(fp: IO[Any] = ..., environ: Mapping[str, str] = ...,
|
||||
keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[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: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
|
||||
if sys.version_info < (3, 8):
|
||||
def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
|
||||
def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def parse_multipart(fp: IO[Any], pdict: Mapping[str, bytes], encoding: str = ..., errors: str = ...) -> Dict[str, List[Any]]: ...
|
||||
else:
|
||||
@@ -17,11 +18,10 @@ def print_environ(environ: Mapping[str, str] = ...) -> None: ...
|
||||
def print_form(form: Dict[str, Any]) -> None: ...
|
||||
def print_directory() -> None: ...
|
||||
def print_environ_usage() -> None: ...
|
||||
if sys.version_info >= (3, 0):
|
||||
def escape(s: str, quote: bool = ...) -> str: ...
|
||||
else:
|
||||
if sys.version_info < (3,):
|
||||
def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ...
|
||||
|
||||
elif sys.version_info < (3, 8):
|
||||
def escape(s: str, quote: bool = ...) -> str: ...
|
||||
|
||||
class MiniFieldStorage:
|
||||
# The first five "Any" attributes here are always None, but mypy doesn't support that
|
||||
@@ -101,7 +101,7 @@ class FieldStorage(object):
|
||||
if sys.version_info < (3, 0):
|
||||
from UserDict import UserDict
|
||||
|
||||
class FormContentDict(UserDict):
|
||||
class FormContentDict(UserDict[str, List[str]]):
|
||||
query_string: str
|
||||
def __init__(self, environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ...
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
from typing import Dict, Any, List, Tuple, Optional, Callable, Type, Union, IO, AnyStr, TypeVar
|
||||
from types import FrameType, TracebackType
|
||||
import sys
|
||||
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
_Path = Union[_T, PathLike[_T]]
|
||||
else:
|
||||
_Path = Union[_T]
|
||||
|
||||
|
||||
def reset() -> str: ... # undocumented
|
||||
def small(text: str) -> str: ... # undocumented
|
||||
def strong(text: str) -> str: ... # undocumented
|
||||
def grey(text: str) -> str: ... # undocumented
|
||||
def lookup(name: str, frame: FrameType, locals: Dict[str, Any]) -> Tuple[Optional[str], Any]: ... # undocumented
|
||||
def scanvars(reader: Callable[[], bytes], frame: FrameType, locals: Dict[str, Any]) -> List[Tuple[str, Optional[str], Any]]: ... # undocumented
|
||||
def html(einfo: _ExcInfo, context: int = ...) -> str: ...
|
||||
def text(einfo: _ExcInfo, context: int = ...) -> str: ...
|
||||
|
||||
class Hook: # undocumented
|
||||
|
||||
def __init__(self, display: int = ..., logdir: Optional[_Path[AnyStr]] = ..., context: int = ..., file: Optional[IO[str]] = ..., format: str = ...) -> None: ...
|
||||
def __call__(self, etype: Optional[Type[BaseException]], evalue: Optional[BaseException], etb: Optional[TracebackType]) -> None: ...
|
||||
def handle(self, info: Optional[_ExcInfo] = ...) -> None: ...
|
||||
|
||||
def handler(info: Optional[_ExcInfo] = ...) -> None: ...
|
||||
|
||||
def enable(display: int = ..., logdir: Optional[_Path[AnyStr]] = ..., context: int = ..., format: str = ...) -> None: ...
|
||||
@@ -31,6 +31,8 @@ class _IncrementalDecoder(Protocol):
|
||||
def encode(obj: _Decoded, encoding: str = ..., errors: str = ...) -> _Encoded: ...
|
||||
def decode(obj: _Encoded, encoding: str = ..., errors: str = ...) -> _Decoded: ...
|
||||
def lookup(encoding: str) -> CodecInfo: ...
|
||||
def utf_16_be_decode(__obj: _Encoded, __errors: str = ..., __final: bool = ...) -> Tuple[_Decoded, int]: ... # undocumented
|
||||
def utf_16_be_encode(__obj: _Decoded, __errors: str = ...) -> Tuple[_Encoded, int]: ... # undocumented
|
||||
|
||||
class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
|
||||
@property
|
||||
@@ -63,7 +65,7 @@ def getincrementalencoder(encoding: str) -> _IncrementalEncoder: ...
|
||||
def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ...
|
||||
def getreader(encoding: str) -> _StreamReader: ...
|
||||
def getwriter(encoding: str) -> _StreamWriter: ...
|
||||
def register(search_function: Callable[[str], CodecInfo]) -> None: ...
|
||||
def register(search_function: Callable[[str], Optional[CodecInfo]]) -> None: ...
|
||||
def open(filename: str, mode: str = ..., encoding: str = ..., errors: str = ..., buffering: int = ...) -> StreamReaderWriter: ...
|
||||
def EncodedFile(file: IO[_Encoded], data_encoding: str, file_encoding: str = ..., errors: str = ...) -> StreamRecoder: ...
|
||||
def iterencode(iterator: Iterable[_Decoded], encoding: str, errors: str = ...) -> Generator[_Encoded, None, None]: ...
|
||||
@@ -186,7 +188,7 @@ class StreamReaderWriter(TextIO):
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(
|
||||
self, typ: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[types.TracebackType]
|
||||
) -> bool: ...
|
||||
) -> None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
# These methods don't actually exist directly, but they are needed to satisfy the TextIO
|
||||
# interface. At runtime, they are delegated through __getattr__.
|
||||
@@ -227,7 +229,7 @@ class StreamRecoder(BinaryIO):
|
||||
def __enter__(self: _SRT) -> _SRT: ...
|
||||
def __exit__(
|
||||
self, type: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType]
|
||||
) -> bool: ...
|
||||
) -> None: ...
|
||||
# These methods don't actually exist directly, but they are needed to satisfy the BinaryIO
|
||||
# interface. At runtime, they are delegated through __getattr__.
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
|
||||
@@ -18,17 +18,20 @@ if sys.version_info >= (3, 7):
|
||||
from typing import AsyncContextManager as AbstractAsyncContextManager
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_F = TypeVar('_F', bound=Callable[..., Any])
|
||||
|
||||
_ExitFunc = Callable[[Optional[Type[BaseException]],
|
||||
Optional[BaseException],
|
||||
Optional[TracebackType]], bool]
|
||||
_CM_EF = TypeVar('_CM_EF', ContextManager, _ExitFunc)
|
||||
_CM_EF = TypeVar('_CM_EF', ContextManager[Any], _ExitFunc)
|
||||
|
||||
if sys.version_info >= (3, 2):
|
||||
class GeneratorContextManager(ContextManager[_T], Generic[_T]):
|
||||
def __call__(self, func: Callable[..., _T]) -> Callable[..., _T]: ...
|
||||
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., GeneratorContextManager[_T]]: ...
|
||||
class _GeneratorContextManager(ContextManager[_T], Generic[_T]):
|
||||
def __call__(self, func: _F) -> _F: ...
|
||||
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., _GeneratorContextManager[_T]]: ...
|
||||
else:
|
||||
class GeneratorContextManager(ContextManager[_T], Generic[_T]):
|
||||
def __call__(self, func: _F) -> _F: ...
|
||||
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., ContextManager[_T]]: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
@@ -43,19 +46,22 @@ class closing(ContextManager[_T], Generic[_T]):
|
||||
if sys.version_info >= (3, 4):
|
||||
class suppress(ContextManager[None]):
|
||||
def __init__(self, *exceptions: Type[BaseException]) -> None: ...
|
||||
def __exit__(self, exctype: Optional[Type[BaseException]],
|
||||
excinst: Optional[BaseException],
|
||||
exctb: Optional[TracebackType]) -> bool: ...
|
||||
|
||||
class redirect_stdout(ContextManager[None]):
|
||||
def __init__(self, new_target: IO[str]) -> None: ...
|
||||
def __init__(self, new_target: Optional[IO[str]]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
class redirect_stderr(ContextManager[None]):
|
||||
def __init__(self, new_target: IO[str]) -> None: ...
|
||||
def __init__(self, new_target: Optional[IO[str]]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
class ContextDecorator:
|
||||
def __call__(self, func: Callable[..., None]) -> Callable[..., ContextManager[None]]: ...
|
||||
|
||||
_U = TypeVar('_U', bound='ExitStack')
|
||||
_U = TypeVar('_U', bound=ExitStack)
|
||||
|
||||
class ExitStack(ContextManager[ExitStack]):
|
||||
def __init__(self) -> None: ...
|
||||
@@ -66,17 +72,20 @@ if sys.version_info >= (3,):
|
||||
def pop_all(self: _U) -> _U: ...
|
||||
def close(self) -> None: ...
|
||||
def __enter__(self: _U) -> _U: ...
|
||||
def __exit__(self, __exc_type: Optional[Type[BaseException]],
|
||||
__exc_value: Optional[BaseException],
|
||||
__traceback: Optional[TracebackType]) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from typing import Awaitable
|
||||
|
||||
_S = TypeVar('_S', bound='AsyncExitStack')
|
||||
_S = TypeVar('_S', bound=AsyncExitStack)
|
||||
|
||||
_ExitCoroFunc = Callable[[Optional[Type[BaseException]],
|
||||
Optional[BaseException],
|
||||
Optional[TracebackType]], Awaitable[bool]]
|
||||
_CallbackCoroFunc = Callable[..., Awaitable[Any]]
|
||||
_ACM_EF = TypeVar('_ACM_EF', AsyncContextManager, _ExitCoroFunc)
|
||||
_ACM_EF = TypeVar('_ACM_EF', AsyncContextManager[Any], _ExitCoroFunc)
|
||||
|
||||
class AsyncExitStack(AsyncContextManager[AsyncExitStack]):
|
||||
def __init__(self) -> None: ...
|
||||
@@ -91,6 +100,9 @@ if sys.version_info >= (3, 7):
|
||||
def pop_all(self: _S) -> _S: ...
|
||||
def aclose(self) -> Awaitable[None]: ...
|
||||
def __aenter__(self: _S) -> Awaitable[_S]: ...
|
||||
def __aexit__(self, __exc_type: Optional[Type[BaseException]],
|
||||
__exc_value: Optional[BaseException],
|
||||
__traceback: Optional[TracebackType]) -> Awaitable[bool]: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
@overload
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import sys
|
||||
from typing import List, NamedTuple, Optional, Union
|
||||
|
||||
from typing import List, Optional, Union
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
class _Method: ...
|
||||
|
||||
+40
-28
@@ -1,24 +1,24 @@
|
||||
from collections import OrderedDict
|
||||
import sys
|
||||
from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Union
|
||||
from _csv import (
|
||||
QUOTE_ALL as QUOTE_ALL,
|
||||
QUOTE_MINIMAL as QUOTE_MINIMAL,
|
||||
QUOTE_NONE as QUOTE_NONE,
|
||||
QUOTE_NONNUMERIC as QUOTE_NONNUMERIC,
|
||||
Error as Error,
|
||||
_reader,
|
||||
_writer,
|
||||
field_size_limit as field_size_limit,
|
||||
get_dialect as get_dialect,
|
||||
list_dialects as list_dialects,
|
||||
reader as reader,
|
||||
register_dialect as register_dialect,
|
||||
unregister_dialect as unregister_dialect,
|
||||
writer as writer,
|
||||
)
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Text, Type, Union
|
||||
|
||||
from _csv import (_reader,
|
||||
_writer,
|
||||
reader as reader,
|
||||
writer as writer,
|
||||
register_dialect as register_dialect,
|
||||
unregister_dialect as unregister_dialect,
|
||||
get_dialect as get_dialect,
|
||||
list_dialects as list_dialects,
|
||||
field_size_limit as field_size_limit,
|
||||
QUOTE_ALL as QUOTE_ALL,
|
||||
QUOTE_MINIMAL as QUOTE_MINIMAL,
|
||||
QUOTE_NONE as QUOTE_NONE,
|
||||
QUOTE_NONNUMERIC as QUOTE_NONNUMERIC,
|
||||
Error as Error,
|
||||
)
|
||||
|
||||
_Dialect = Union[str, Dialect]
|
||||
_Dialect = Union[str, Dialect, Type[Dialect]]
|
||||
_DictRow = Mapping[str, Any]
|
||||
|
||||
class Dialect(object):
|
||||
@@ -56,7 +56,6 @@ if sys.version_info >= (3, 6):
|
||||
else:
|
||||
_DRMapping = Dict[str, str]
|
||||
|
||||
|
||||
class DictReader(Iterator[_DRMapping]):
|
||||
restkey: Optional[str]
|
||||
restval: Optional[str]
|
||||
@@ -64,24 +63,37 @@ class DictReader(Iterator[_DRMapping]):
|
||||
dialect: _Dialect
|
||||
line_num: int
|
||||
fieldnames: Sequence[str]
|
||||
def __init__(self, f: Iterable[str], fieldnames: Sequence[str] = ...,
|
||||
restkey: Optional[str] = ..., restval: Optional[str] = ..., dialect: _Dialect = ...,
|
||||
*args: Any, **kwds: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
f: Iterable[Text],
|
||||
fieldnames: Optional[Sequence[str]] = ...,
|
||||
restkey: Optional[str] = ...,
|
||||
restval: Optional[str] = ...,
|
||||
dialect: _Dialect = ...,
|
||||
*args: Any,
|
||||
**kwds: Any,
|
||||
) -> None: ...
|
||||
def __iter__(self) -> DictReader: ...
|
||||
if sys.version_info >= (3,):
|
||||
def __next__(self) -> _DRMapping: ...
|
||||
else:
|
||||
def next(self) -> _DRMapping: ...
|
||||
|
||||
|
||||
class DictWriter(object):
|
||||
fieldnames: Sequence[str]
|
||||
restval: Optional[Any]
|
||||
extrasaction: str
|
||||
writer: _writer
|
||||
def __init__(self, f: Any, fieldnames: Sequence[str],
|
||||
restval: Optional[Any] = ..., extrasaction: str = ..., dialect: _Dialect = ...,
|
||||
*args: Any, **kwds: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
f: Any,
|
||||
fieldnames: Iterable[str],
|
||||
restval: Optional[Any] = ...,
|
||||
extrasaction: str = ...,
|
||||
dialect: _Dialect = ...,
|
||||
*args: Any,
|
||||
**kwds: Any,
|
||||
) -> None: ...
|
||||
def writeheader(self) -> None: ...
|
||||
def writerow(self, rowdict: _DictRow) -> None: ...
|
||||
def writerows(self, rowdicts: Iterable[_DictRow]) -> None: ...
|
||||
@@ -89,5 +101,5 @@ class DictWriter(object):
|
||||
class Sniffer(object):
|
||||
preferred: List[str]
|
||||
def __init__(self) -> None: ...
|
||||
def sniff(self, sample: str, delimiters: Optional[str] = ...) -> Dialect: ...
|
||||
def sniff(self, sample: str, delimiters: Optional[str] = ...) -> Type[Dialect]: ...
|
||||
def has_header(self, sample: str) -> bool: ...
|
||||
|
||||
@@ -24,8 +24,15 @@ class CDLL(object):
|
||||
_name: str = ...
|
||||
_handle: int = ...
|
||||
_FuncPtr: Type[_FuncPointer] = ...
|
||||
def __init__(self, name: str, mode: int = ..., handle: Optional[int] = ...,
|
||||
use_errno: bool = ..., use_last_error: bool = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
mode: int = ...,
|
||||
handle: Optional[int] = ...,
|
||||
use_errno: bool = ...,
|
||||
use_last_error: bool = ...,
|
||||
winmode: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
def __getattr__(self, name: str) -> _FuncPointer: ...
|
||||
def __getitem__(self, name: str) -> _FuncPointer: ...
|
||||
if sys.platform == 'win32':
|
||||
@@ -228,7 +235,7 @@ class c_wchar_p(_PointerLike, _SimpleCData[Optional[Text]]):
|
||||
def __init__(self, value: Optional[_UnionT[int, Text]] = ...) -> None: ...
|
||||
|
||||
class c_bool(_SimpleCData[bool]):
|
||||
def __init__(self, value: bool) -> None: ...
|
||||
def __init__(self, value: bool = ...) -> None: ...
|
||||
|
||||
if sys.platform == 'win32':
|
||||
class HRESULT(_SimpleCData[int]): ... # TODO undocumented
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
from _curses import * # noqa: F403
|
||||
from _curses import _CursesWindow as _CursesWindow
|
||||
from typing import TypeVar, Callable, Any
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
# available after calling `curses.initscr()`
|
||||
LINES: int
|
||||
COLS: int
|
||||
|
||||
# available after calling `curses.start_color()`
|
||||
COLORS: int
|
||||
COLOR_PAIRS: int
|
||||
|
||||
def wrapper(func: Callable[..., _T], *arg: Any, **kwds: Any) -> _T: ...
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user