1 Commits

Author SHA1 Message Date
Dave Halter 74b5289e33 Make sure that the context manager for sqlite3.Connection works
This was originally reported in https://github.com/davidhalter/jedi/issues/1084.
2019-12-14 02:00:09 +01:00
1193 changed files with 23855 additions and 40761 deletions
+15 -18
View File
@@ -1,26 +1,23 @@
# Some PEP8 deviations are considered irrelevant to stub files:
# E301 expected 1 blank line
# E302 expected 2 blank lines
# E305 expected 2 blank lines
# E701 multiple statements on one line (colon)
# E741 ambiguous variable name
# F401 imported but unused
# F403 import *' used; unable to detect undefined names
# F405 defined from star imports
# F822 undefined name in __all__
# (error counts as of 2017-05-22)
# 17952 E704 multiple statements on one line (def)
# 12197 E301 expected 1 blank line
# 7155 E302 expected 2 blank lines
# 1463 F401 imported but unused
# 967 E701 multiple statements on one line (colon)
# 457 F811 redefinition (should be fixed in pyflakes 2.1.2)
# 390 E305 expected 2 blank lines
# 4 E741 ambiguous variable name
# Nice-to-haves ignored for now
# E501 line too long
# 2307 E501 line too long
# Other ignored warnings
# W504 line break after binary operator
[flake8]
per-file-ignores =
*.py: E203, W503
*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822
# Since typing.pyi defines "overload" this is not recognized by flake8 as typing.overload.
# Unfortunately, flake8 does not allow to "noqa" just a specific error inside the file itself.
typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822
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.
builtins = StandardError,apply,basestring,buffer,cmp,coerce,execfile,file,intern,long,raw_input,reduce,reload,unichr,unicode,xrange
exclude = .venv*,@*,.git,*_pb2.pyi
exclude = .venv*,@*,.git
max-line-length = 130
-53
View File
@@ -1,53 +0,0 @@
name: Run mypy_primer
on:
# Only run on PR, since we diff against master
pull_request:
jobs:
mypy_primer:
name: Run
runs-on: ubuntu-latest
strategy:
matrix:
shard-index: [0, 1]
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
path: typeshed_to_test
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install -U pip
pip install git+https://github.com/hauntsaninja/mypy_primer.git
- name: Run mypy_primer
shell: bash
run: |
cd typeshed_to_test
echo "new commit"
git rev-list --format=%s --max-count=1 $GITHUB_SHA
git checkout -b upstream_master origin/master
echo "base commit"
git rev-list --format=%s --max-count=1 upstream_master
echo ''
cd ..
# fail action if exit code isn't zero or one
(
mypy_primer \
--new 0.790 --old 0.790 \
--custom-typeshed-repo typeshed_to_test \
--new-typeshed $GITHUB_SHA --old-typeshed upstream_master \
--num-shards 2 --shard-index ${{ matrix.shard-index }} \
--debug \
--output concise \
| tee diff.txt
) || [ $? -eq 1 ]
- name: Upload mypy_primer diff
uses: actions/upload-artifact@v2
with:
name: mypy_primer_diff_${{ matrix.shard-index }}
path: diff.txt
-103
View File
@@ -1,103 +0,0 @@
name: Comment with mypy_primer diff
on:
# pull_request_target gives us access to a write token which we need to post a comment
# The presence of a write token means that we can't run any untrusted code (i.e. malicious PRs),
# which is why this its own workflow. Github Actions doesn't make it easy for workflows to talk to
# each other, so the approach here is to poll for workflow runs, find the mypy_primer run for our
# commit, wait till it's completed, and download and post the diff.
pull_request_target:
jobs:
mypy_primer:
name: Comment
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: npm install adm-zip
- name: Post comment
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const AdmZip = require(`${process.env.GITHUB_WORKSPACE}/node_modules/adm-zip`)
// Because of pull_request_target, context.sha is the PR base branch
// So we need to ask Github for the SHA of the PR's head commit
const pull_request = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
})
const pr_commit_sha = pull_request.data.head.sha
console.log("Looking for mypy_primer run for commit:", pr_commit_sha)
// Find the mypy_primer run for our commit and wait till it's completed
// We wait up to an hour before timing out
async function check_mypy_primer() {
// We're only looking at the first page, so in theory if we open enough PRs around
// the same time, this will fail to find the run.
const response = await github.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: "mypy_primer.yml",
})
if (response) {
return response.data.workflow_runs.find(run => run.head_sha == pr_commit_sha)
}
return undefined
}
const end_time = Number(new Date()) + 60 * 60 * 1000
let primer_run = await check_mypy_primer()
while (!primer_run || primer_run.status != "completed") {
if (Number(new Date()) > end_time) {
throw Error("Timed out waiting for mypy_primer")
}
console.log("Waiting for mypy_primer to complete...")
await new Promise(r => setTimeout(r, 10000))
primer_run = await check_mypy_primer()
}
console.log("Found mypy_primer run!")
console.log(primer_run)
// Download artifact(s) from the run
const artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: primer_run.id,
})
const filtered_artifacts = artifacts.data.artifacts.filter(
a => a.name.startsWith("mypy_primer_diff")
)
console.log("Artifacts from mypy_primer:")
console.log(filtered_artifacts)
async function get_artifact_data(artifact) {
const zip = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: "zip",
})
const adm = new AdmZip(Buffer.from(zip.data))
return adm.readAsText(adm.getEntry("diff.txt"))
}
const all_data = await Promise.all(filtered_artifacts.map(get_artifact_data))
const data = all_data.join("\n")
console.log("Diff from mypy_primer:")
console.log(data)
try {
if (data.trim()) {
await github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Diff from [mypy_primer](https://github.com/hauntsaninja/mypy_primer), showing the effect of this PR on open source code:\n```diff\n' + data + '```'
})
}
} catch (error) {
console.log(error)
}
@@ -1,56 +0,0 @@
name: Remove unused stubtest whitelist entries
on:
workflow_dispatch:
schedule:
- cron: '0 4 * * SAT'
jobs:
stubtest:
if: github.repository == 'python/typeshed'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
python-version: [3.6, 3.7, 3.8, 3.9]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U git+git://github.com/python/mypy@24fdf343
- name: Run stubtest
shell: bash
run: ./tests/stubtest_unused.py | tee stubtest-output-${{ matrix.os }}-${{ matrix.python-version }} || true
- name: Store output
uses: actions/upload-artifact@v2
with:
name: stubtest-output
path: stubtest-output-${{ matrix.os }}-${{ matrix.python-version }}
collate:
if: github.repository == 'python/typeshed'
runs-on: ubuntu-latest
needs: stubtest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Get stubtest outputs
uses: actions/download-artifact@v2
with:
name: stubtest-output
- name: Collate duplicates
run: cat stubtest-output-* | sort -u | tee stubtest-output
- name: Remove entries from whitelists
run: python scripts/update-stubtest-whitelist.py stubtest-output
- name: Create pull request
uses: peter-evans/create-pull-request@v3
with:
commit-message: Remove unused stubtest whitelist entries
title: "[gh-action] Remove unused stubtest whitelist entries"
-106
View File
@@ -1,106 +0,0 @@
name: Check stubs
on:
push:
pull_request:
jobs:
file-consistency:
name: Check file consistency
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: ./tests/check_consistent.py
flake8:
name: Lint with flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: |
pip install $(grep flake8 requirements-tests-py3.txt)
flake8
black:
name: Check formatting with black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: |
pip install $(grep black requirements-tests-py3.txt)
black --check --diff stdlib third_party
isort:
name: Check imports with isort
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: |
pip install $(grep isort requirements-tests-py3.txt)
isort --check-only --diff stdlib third_party
pytype:
name: Run pytype against the stubs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.6
- run: pip install -r requirements-tests-py3.txt
- run: ./tests/pytype_test.py
mypy:
name: Run mypy against the stubs
runs-on: ubuntu-latest
strategy:
matrix:
platform: ["linux", "win32", "darwin"]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install -U git+git://github.com/python/mypy
- run: ./tests/mypy_test.py --platform=${{ matrix.platform }}
mypy-self-check:
name: Check mypy source with itself
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: ./tests/mypy_self_check.py
mypy-test-suite:
name: Run the mypy test suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: ./tests/mypy_test_suite.py
stubtest:
name: Check stubs with stubtest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
python-version: [3.6, 3.7, 3.8, 3.9]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U git+git://github.com/python/mypy@24fdf343
- name: Run stubtest
run: python tests/stubtest_test.py --ignore-unused-whitelist
-1
View File
@@ -39,7 +39,6 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
stubtest-output*
# Translations
*.mo
+31
View File
@@ -0,0 +1,31 @@
dist: bionic
language: python
python: 3.8
jobs:
include:
- name: "pytype"
python: 3.6
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"
script: ./tests/mypy_selftest.py
- name: "check file consistency"
script: ./tests/check_consistent.py
- name: "flake8"
install: pip install -r requirements-tests-py3.txt
script: flake8
+4 -33
View File
@@ -15,7 +15,6 @@ are important to the project's success.
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`.
* Reformat your stubs with `black` and `isort`.
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.
@@ -86,8 +85,6 @@ At present the core developers are (alphabetically):
* Greg Price (@gnprice)
* Sebastian Rittau (@srittau)
* Guido van Rossum (@gvanrossum)
* Shantanu (@hauntsaninja)
* Rune Tynan (@CraftSpider)
* Jelle Zijlstra (@JelleZijlstra)
NOTE: the process for preparing and submitting changes also applies to
@@ -159,7 +156,7 @@ annotated function `bar()`:
def __getattr__(name: str) -> Any: ... # incomplete
class Foo:
def __getattr__(self, name: str) -> Any: ... # incomplete
def __getattr__(self, name: str) -> Any: # incomplete
x: int
y: str
@@ -223,14 +220,8 @@ rule is that they should be as concise as possible. Specifically:
* use variable annotations instead of type comments, even for stubs
that target older versions of Python;
* for arguments with a type and a default, use spaces around the `=`.
Stubs should be reformatted with the formatters
[black](https://github.com/psf/black) and
[isort](https://github.com/PyCQA/isort) before submission.
These formatters are included in typeshed's `requirements-tests-py3.txt` file.
A sample `pre-commit` file is included in the typeshed repository. Copy it
to `.git/hooks` and adjust the path to your virtual environment's `bin`
directory to automatically reformat stubs before commit.
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
checker, and leave out unnecessary detail:
@@ -285,23 +276,13 @@ 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 exceptions -- if it sometimes returns `True`
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.
A few guidelines for protocol names below. In cases that don't fall
into any of those categories, use your best judgement.
* Use plain names for protocols that represent a clear concept
(e.g. `Iterator`, `Container`).
* Use `SupportsX` for protocols that provide callable methods (e.g.
`SupportsInt`, `SupportsRead`, `SupportsReadSeek`).
* Use `HasX` for protocols that have readable and/or writable attributes
or getter/setter methods (e.g. `HasItems`, `HasFileno`).
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.
@@ -392,13 +373,3 @@ Core developers should follow these rules when processing pull requests:
* 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.
When reviewing PRs, follow these guidelines:
* Typing is hard. Try to be helpful and explain issues with the PR,
especially to new contributors.
* When reviewing auto-generated stubs, just scan for red flags and obvious
errors. Leave possible manual improvements for separate PRs.
* When reviewing large, hand-crafted PRs, you only need to look for red flags
and general issues, and do a few spot checks.
* Review smaller, hand-crafted PRs thoroughly.
+48 -102
View File
@@ -1,6 +1,6 @@
# typeshed
[![Build status](https://github.com/python/typeshed/workflows/Check%20stubs/badge.svg)](https://github.com/python/typeshed/actions?query=workflow%3A%22Check+stubs%22)
[![Build Status](https://travis-ci.org/python/typeshed.svg?branch=master)](https://travis-ci.org/python/typeshed)
[![Chat at https://gitter.im/python/typing](https://badges.gitter.im/python/typing.svg)](https://gitter.im/python/typing?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Pull Requests Welcome](https://img.shields.io/badge/pull%20requests-welcome-brightgreen.svg)](https://github.com/python/typeshed/blob/master/CONTRIBUTING.md)
@@ -17,7 +17,7 @@ contributors can be found in [CONTRIBUTING.md](CONTRIBUTING.md). **Please read
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.6 and up.
Typeshed supports Python versions 2.7 and 3.5 and up.
## Using
@@ -74,17 +74,18 @@ go into `third_party`. Since these modules can behave differently for different
versions of Python, `third_party` has version subdirectories, just like
`stdlib`.
NOTE: When you're contributing a new stub for a package that you did
not develop, please obtain consent of the package owner (this is
specified in [PEP
484](https://www.python.org/dev/peps/pep-0484/#the-typeshed-repo)).
The best way to obtain consent is to file an issue in the third-party
package's tracker and include the link to a positive response in your PR
for typeshed.
For more information on directory structure and stub versioning, see
[the relevant section of CONTRIBUTING.md](
https://github.com/python/typeshed/blob/master/CONTRIBUTING.md#stub-versioning).
Third-party packages are generally removed from typeshed when one of the
following criteria is met:
* The upstream package ships a py.typed file for at least 6-12 months, or
* the package does not support any of the Python versions supported by
typeshed.
## Contributing
Please read [CONTRIBUTING.md](CONTRIBUTING.md) before submitting pull
@@ -92,113 +93,58 @@ requests. If you have questions related to contributing, drop by the [typing Git
## Running the tests
The tests are automatically run on every PR and push to
the repo.
There are several tests:
- `tests/mypy_test.py`
tests typeshed with [mypy](https://github.com/python/mypy/)
- `tests/pytype_test.py` tests typeshed with
The tests are automatically run by Travis CI on every PR and push to
the repo. There are several sets of tests: `tests/mypy_test.py`
runs tests against [mypy](https://github.com/python/mypy/), while
`tests/pytype_test.py` runs tests against
[pytype](https://github.com/google/pytype/).
- `tests/mypy_self_check.py` checks mypy's code base using this version of
typeshed.
- `tests/mypy_test_suite.py` runs a subset of mypy's test suite using this version of
typeshed.
- `tests/check_consistent.py` checks certain files in typeshed remain
consistent with each other.
- `tests/stubtest_test.py` checks stubs against the objects at runtime.
- `flake8` enforces a style guide.
### Setup
Both sets of tests are shallow -- they verify that all stubs can be
imported but they don't check whether stubs match their implementation
(in the Python standard library or a third-party package). Also note
that each set of tests has a blacklist of modules that are not tested
at all. The blacklists also live in the tests directory.
In addition, you can run `tests/mypy_selftest.py` to run mypy's own
test suite using the typeshed code in your repo. This will sometimes
catch issues with incorrectly typed stubs, but is much slower than the
other tests.
To manually run the mypy tests, you need to have Python 3.5 or higher;
Python 3.6.1 or higher is recommended.
Run:
```
$ python3.6 -m venv .venv3
$ source .venv3/bin/activate
(.venv3)$ pip install -U pip
(.venv3)$ pip install -r requirements-tests-py3.txt
(.venv3)$ pip3 install -r requirements-tests-py3.txt
```
This will install mypy (you need the latest master branch from GitHub),
typed-ast, flake8 (and plugins), pytype, black and isort.
typed-ast, flake8, and pytype. You can then run mypy, flake8, and pytype tests
by invoking:
```
(.venv3)$ python3 tests/mypy_test.py
...
(.venv3)$ python3 tests/mypy_selftest.py
...
(.venv3)$ flake8
...
(.venv3)$ python3 tests/pytype_test.py
...
```
Note that flake8 only works with Python 3.6 or higher, and that to run the
pytype tests, you will need Python 2.7 and Python 3.6 interpreters. Pytype will
find these automatically if they're in `PATH`, but otherwise you must point to
them with the `--python27-exe` and `--python36-exe` arguments, respectively.
### mypy_test.py
This test requires Python 3.6 or higher; Python 3.6.1 or higher is recommended.
Run using:`(.venv3)$ python3 tests/mypy_test.py`
This test is shallow — it verifies that all stubs can be
imported but doesn't check whether stubs match their implementation
(in the Python standard library or a third-party package). It has an exclude list of
modules that are not tested at all, which also lives in the tests directory.
If you are in the typeshed repo that is submodule of the
For mypy, if you are in the typeshed repo that is submodule of the
mypy repo (so `..` refers to the mypy repo), there's a shortcut to run
the mypy tests that avoids installing mypy:
```bash
$ PYTHONPATH=../.. python3 tests/mypy_test.py
```
You can restrict mypy tests to a single version by passing `-p2` or `-p3.9`:
You can mypy tests to a single version by passing `-p2` or `-p3.5` e.g.
```bash
$ PYTHONPATH=../.. python3 tests/mypy_test.py -p3.9
running mypy --python-version 3.9 --strict-optional # with 342 files
$ PYTHONPATH=../.. python3 tests/mypy_test.py -p3.5
running mypy --python-version 3.5 --strict-optional # with 342 files
```
### pytype_test.py
This test requires Python 2.7 and Python 3.6. Pytype will
find these automatically if they're in `PATH`, but otherwise you must point to
them with the `--python27-exe` and `--python36-exe` arguments, respectively.
Run using: `(.venv3)$ python3 tests/pytype_test.py`
This test works similarly to `mypy_test.py`, except it uses `pytype`.
### mypy_self_check.py
This test requires Python 3.6 or higher; Python 3.6.1 or higher is recommended.
Run using: `(.venv3)$ python3 tests/mypy_self_check.py`
This test checks mypy's code base using mypy and typeshed code in this repo.
### mypy_test_suite.py
This test requires Python 3.5 or higher; Python 3.6.1 or higher is recommended.
Run using: `(.venv3)$ python3 tests/mypy_test_suite.py`
This test runs mypy's own test suite using the typeshed code in your repo. This
will sometimes catch issues with incorrectly typed stubs, but is much slower
than the other tests.
### check_consistent.py
Run using: `python3 tests/check_consistent.py`
### stubtest_test.py
This test requires Python 3.6 or higher.
Run using `(.venv3)$ python3 tests/stubtest_test.py`
This test compares the stdlib stubs against the objects at runtime. Because of
this, the output depends on which version of Python and on what kind of system
it is run.
Thus the easiest way to run this test is via Github Actions on your fork;
if you run it locally, it'll likely complain about system-specific
differences (in e.g, `socket`) that the type system cannot capture.
If you need a specific version of Python to repro a CI failure,
[pyenv](https://github.com/pyenv/pyenv) can help.
Due to its dynamic nature, you may run into false positives. In this case, you
can add to the whitelists for each affected Python version in
`tests/stubtest_whitelists`. Please file issues for stubtest false positives
at [mypy](https://github.com/python/mypy/issues).
To run stubtest against third party stubs, it's easiest to use stubtest
directly, with `(.venv3)$ python3 -m mypy.stubtest --custom-typeshed-dir
<path-to-typeshed> <third-party-module>`.
stubtest can also help you find things missing from the stubs.
### flake8
flake8 requires Python 3.6 or higher. Run using: `(.venv3)$ flake8`
Note typeshed uses the `flake8-pyi` and `flake8-bugbear` plugins.
-28
View File
@@ -1,28 +0,0 @@
#!/bin/sh
#
# An example hook script that will run flake8, black, and isort
# prior to committing and will stop the commit if there are any
# warnings. Adjust BIN_DIR to the virtual environment where flake8,
# black, and isort are installed.
#
# To enable this hook, copy this file to ".git/hooks".
BIN_DIR=./.venv/bin
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=AM | grep .pyi || true)
if test -n "${CHANGED_FILES}" -a -d "${BIN_DIR}"; then
${BIN_DIR}/flake8 ${CHANGED_FILES}
${BIN_DIR}/black --check ${CHANGED_FILES}
${BIN_DIR}/isort --check-only ${CHANGED_FILES}
# Replace the last two lines with the following lines
# if you want to reformat changed files automatically
# before committing. Please note that partial commits
# (git add -p) will not work and will commit the whole
# file!
#
# ${BIN_DIR}/black ${CHANGED_FILES} || true
# ${BIN_DIR}/isort -y ${CHANGED_FILES} || true
# git add ${CHANGED_FILES}
fi
+4 -36
View File
@@ -1,43 +1,11 @@
[tool.black]
line_length = 130
target_version = ["py37"]
exclude = ".*_pb2.pyi"
[tool.isort]
profile = "black"
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
combine_as_imports = true
line_length = 130
skip_glob = "*_pb2.pyi"
extra_standard_library = [
"typing_extensions",
"_typeshed",
# Extra modules not recognized by isort
"_compression",
"_csv",
"_curses",
"_markupbase",
"_random",
"_tkinter",
"_weakrefset",
"genericpath",
"opcode",
"pyexpat",
# Python 2 modules
"__builtin__",
"cookielib",
"cStringIO",
"httplib",
"mimetools",
"rfc822",
"thread",
"urllib2",
"urlparse",
"BaseHTTPServer",
"Queue",
"SimpleHTTPServer",
"SocketServer",
"StringIO",
"UserDict",
"UserList",
"UserString",
]
+6 -6
View File
@@ -1,8 +1,8 @@
git+https://github.com/python/mypy.git@master
typed-ast>=1.0.4
black==20.8b1
flake8==3.8.4
flake8-bugbear==20.1.4
flake8-pyi==20.10.0
isort[pyproject]==5.5.3
pytype>=2020.09.16
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
-68
View File
@@ -1,68 +0,0 @@
#!/bin/bash
# Some of the proto .pyi stubs in third_party/2and3/google/protobuf/
# are autogenerated using the mypy-protobuf project on the
# latest `.proto` files shipped with protoc.
#
# When run, this script will autogenerate the _pb2.pyi stubs to
# third_party/2and3/google/protobuf. It should be run any time there's
# a meaningful update to either PROTOBUF_VERSION or MYPY_PROTOBUF_VERSION,
# followed by committing the changes to typeshed
#
# Update these two variables when rerunning script
PROTOBUF_VERSION=3.14.0
MYPY_PROTOBUF_VERSION=8639282dae3bb64b2e1db9928d72fc374f7fa831 # Update to 1.24 when it releases
set -ex
if uname -a | grep Darwin; then
PLAT=osx
else
PLAT=linux
fi
REPO_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}")/..)
TMP_DIR=$(mktemp -d)
PYTHON_PROTOBUF_FILENAME=protobuf-python-${PROTOBUF_VERSION}.zip
PROTOC_FILENAME=protoc-${PROTOBUF_VERSION}-${PLAT}-x86_64.zip
PROTOC_URL=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/${PROTOC_FILENAME}
PYTHON_PROTOBUF_URL=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/${PYTHON_PROTOBUF_FILENAME}
cd $TMP_DIR
echo "Working in $TMP_DIR"
# Install protoc
wget $PROTOC_URL
mkdir protoc_install
unzip $PROTOC_FILENAME -d protoc_install
# Fetch protoc-python (which contains all the .proto files)
wget $PYTHON_PROTOBUF_URL
unzip $PYTHON_PROTOBUF_FILENAME
PYTHON_PROTOBUF_DIR=protobuf-$PROTOBUF_VERSION
# Install mypy-protobuf
VENV=venv
python3 -m virtualenv $VENV
source $VENV/bin/activate
python3 -m pip install git+https://github.com/dropbox/mypy-protobuf@${MYPY_PROTOBUF_VERSION}#subdirectory=python
# Remove existing pyi
find $REPO_ROOT/third_party/2and3/ -name "*_pb2.pyi" -delete
# Roughly reproduce the subset of .proto files on the public interface as described
# by find_package_modules in the protobuf setup.py.
# The logic (as of 3.14.0) can roughly be described as a whitelist of .proto files
# further limited to exclude *test* and internal/
# https://github.com/protocolbuffers/protobuf/blob/master/python/setup.py
PROTO_FILES=$(grep "generate_proto.*google" $PYTHON_PROTOBUF_DIR/python/setup.py | \
cut -d\" -f2 | \
grep -v "test" | \
grep -v google/protobuf/internal/ | \
grep -v google/protobuf/pyext/python.proto | \
grep -v src/google/protobuf/util/json_format.proto | \
grep -v src/google/protobuf/util/json_format_proto3.proto | \
sed "s:^:$PYTHON_PROTOBUF_DIR/python/:" | \
xargs -L1 realpath --relative-to=. \
)
# And regenerate!
protoc_install/bin/protoc --proto_path=$PYTHON_PROTOBUF_DIR/src --mypy_out=$REPO_ROOT/third_party/2and3 $PROTO_FILES
-337
View File
@@ -1,337 +0,0 @@
"""
Ad-hoc script to migrate typeshed to a new directory structure proposed in
https://github.com/python/typeshed/issues/2491#issuecomment-611607557
"""
import ast
import os
import os.path
import shutil
from dataclasses import dataclass
from typing import List, Optional, Set, Tuple
# These names may be still discussed so I make them constants.
STDLIB_NAMESPACE = "stdlib"
THIRD_PARTY_NAMESPACE = "stubs"
DEFAULT_VERSION = "0.1"
DEFAULT_PY3_VERSION = "3.6"
PY2_NAMESPACE = "python2"
OUTPUT_DIR = "out"
# Third party imports (type ignored) of missing stubs.
MISSING_WHITELIST = {
"thrift",
}
# Manually collected special cases where distribution name and
# package name are different.
package_to_distribution = {
"_pytest": "pytest",
"yaml": "PyYAML",
"typing_extensions": "typing-extensions",
"mypy_extensions": "mypy-extensions",
"pyre_extensions": "pyre-extensions",
"attr": "attrs",
"concurrent": "futures",
"Crypto": "pycrypto",
"datetimerange": "DateTimeRange",
"dateutil": "python-dateutil",
"enum": "enum34",
"flask": "Flask",
"gflags": "python-gflags",
"google": "protobuf",
"jinja2": "Jinja2",
"markupsafe": "MarkupSafe",
"OpenSSL": "openssl-python",
"pymysql": "PyMySQL",
"pyVmomi": "pyvmomi",
"routes": "Routes",
"typed_ast": "typed-ast",
"werkzeug": "Werkzeug",
}
known_versions = {
"mypy-extensions": "0.4",
"typing-extensions": "3.7",
"typed-ast": "1.4",
}
# Classes with "Package" in name represent both packages and modules.
# The latter two are distinguished by is_dir flag.
class PackageBase:
"""Common attributes for packages/modules"""
path: str # full initial path like stdlib/2and3/argparse.pyi
is_dir: bool
@property
def name(self) -> str:
_, tail = os.path.split(self.path)
if self.is_dir:
assert not tail.endswith(".pyi")
return tail
assert tail.endswith(".pyi")
name, _ = os.path.splitext(tail)
return name
@dataclass
class StdLibPackage(PackageBase):
"""Package/module in standard library."""
path: str
py_version: Optional[str] # Can be omitted for Python 2 only packages.
is_dir: bool
@dataclass
class ThirdPartyPackage(PackageBase):
path: str
py2_compatible: bool
py3_compatible: bool
is_dir: bool
requires: List[str] # distributions this depends on
def add_stdlib_packages_from(subdir: str, packages: List[StdLibPackage], py_version: Optional[str]) -> None:
"""Add standard library packages/modules from a given stdlib/xxx subdirectory.
Append to packages list in-place, use py_version as the minimal supported version.
"""
for name in os.listdir(subdir):
path = os.path.join(subdir, name)
packages.append(StdLibPackage(path, py_version, is_dir=os.path.isdir(path)))
def collect_stdlib_packages() -> Tuple[List[StdLibPackage], List[StdLibPackage]]:
"""Collect standard library packages/modules from all current stdlib/xxx sub-directories."""
stdlib: List[StdLibPackage] = []
py2_stdlib: List[StdLibPackage] = []
# These will go to a separate subdirectory.
add_stdlib_packages_from("stdlib/2", py2_stdlib, None)
add_stdlib_packages_from("stdlib/2and3", stdlib, "2.7")
# Use oldest currently supported version for Python 3 packages/modules.
add_stdlib_packages_from("stdlib/3", stdlib, DEFAULT_PY3_VERSION)
for version in ("3.7", "3.8", "3.9"):
subdir = os.path.join("stdlib", version)
if os.path.isdir(subdir):
add_stdlib_packages_from(subdir, stdlib, version)
return stdlib, py2_stdlib
def add_third_party_packages_from(
subdir: str, packages: List[ThirdPartyPackage], py2_compatible: bool, py3_compatible: bool
) -> None:
"""Add third party packages/modules from a given third_party/xxx subdirectory."""
for name in os.listdir(subdir):
path = os.path.join(subdir, name)
packages.append(ThirdPartyPackage(path, py2_compatible, py3_compatible, requires=[], is_dir=os.path.isdir(path)))
def collect_third_party_packages() -> Tuple[List[ThirdPartyPackage], List[ThirdPartyPackage]]:
"""Collect third party packages/modules from all current third_party/xxx sub-directories."""
third_party: List[ThirdPartyPackage] = []
py2_third_party: List[ThirdPartyPackage] = []
add_third_party_packages_from("third_party/3", third_party, py2_compatible=False, py3_compatible=True)
add_third_party_packages_from("third_party/2and3", third_party, py2_compatible=True, py3_compatible=True)
# We special-case Python 2 for third party packages like six.
subdir = "third_party/2"
py3_packages = os.listdir("third_party/3")
for name in os.listdir(subdir):
path = os.path.join(subdir, name)
package = ThirdPartyPackage(path, py2_compatible=True, py3_compatible=False, requires=[], is_dir=os.path.isdir(path))
if name in py3_packages:
# If there is a package with the same name in /2 and /3, we add the former to
# a separate list, packages from there will be put into /python2 sub-directories.
py2_third_party.append(package)
else:
third_party.append(package)
return third_party, py2_third_party
def get_top_imported_names(file: str) -> Set[str]:
"""Collect names imported in given file.
We only collect top-level names, i.e. `from foo.bar import baz`
will only add `foo` to the list.
"""
if not file.endswith(".pyi"):
return set()
with open(os.path.join(file), "rb") as f:
content = f.read()
parsed = ast.parse(content)
top_imported = set()
for node in ast.walk(parsed):
if isinstance(node, ast.Import):
for name in node.names:
top_imported.add(name.name.split(".")[0])
elif isinstance(node, ast.ImportFrom):
if node.level > 0:
# Relative imports always refer to the current package.
continue
assert node.module
top_imported.add(node.module.split(".")[0])
return top_imported
def populate_requirements(
package: ThirdPartyPackage, stdlib: List[str], py2_stdlib: List[str], known_distributions: Set[str]
) -> None:
"""Generate requirements using imports found in a package."""
assert not package.requires, "Populate must be called once"
if not package.is_dir:
all_top_imports = get_top_imported_names(package.path)
else:
all_top_imports = set()
for dir_path, _, file_names in os.walk(package.path):
for file_name in file_names:
all_top_imports |= get_top_imported_names(os.path.join(dir_path, file_name))
# Generate dependencies using collected imports.
requirements = set()
for name in all_top_imports:
# Note: dependencies are between distributions, not packages.
distribution = package_to_distribution.get(name, name)
if package.py3_compatible and name not in stdlib:
if distribution in known_distributions:
requirements.add(distribution)
else:
# Likely a conditional import.
assert distribution in py2_stdlib or distribution in MISSING_WHITELIST
if package.py2_compatible and name not in py2_stdlib:
if distribution in known_distributions:
requirements.add(distribution)
else:
# Likely a conditional import.
assert distribution in stdlib or distribution in MISSING_WHITELIST
# Remove dependency to itself generated by absolute imports.
current_distribution = package_to_distribution.get(package.name, package.name)
package.requires = sorted(requirements - {current_distribution})
def generate_versions(packages: List[StdLibPackage]) -> str:
"""Generate the stdlib/VERSIONS file for packages/modules."""
lines = []
for package in packages:
assert package.py_version is not None
lines.append(f"{package.name}: {package.py_version}")
return "\n".join(sorted(lines))
def copy_stdlib(packages: List[StdLibPackage], py2_packages: List[StdLibPackage]) -> None:
"""Refactor the standard library part using collected metadata."""
stdlib_dir = os.path.join(OUTPUT_DIR, STDLIB_NAMESPACE)
os.makedirs(stdlib_dir, exist_ok=True)
# Write version metadata.
with open(os.path.join(stdlib_dir, "VERSIONS"), "w") as f:
f.write(generate_versions(packages))
f.write("\n")
# Copy stdlib/2and3 and stdlib/3 packages/modules.
for package in packages:
if not package.is_dir:
shutil.copy(package.path, stdlib_dir)
else:
shutil.copytree(package.path, os.path.join(stdlib_dir, package.name))
# Copy stdlib/2 packages/modules to a nested /python namespace.
if py2_packages:
py2_stdlib_dir = os.path.join(stdlib_dir, PY2_NAMESPACE)
os.makedirs(py2_stdlib_dir, exist_ok=True)
for package in py2_packages:
if not package.is_dir:
shutil.copy(package.path, py2_stdlib_dir)
else:
shutil.copytree(package.path, os.path.join(py2_stdlib_dir, package.name))
def generate_metadata(package: ThirdPartyPackage, py2_packages: List[str]) -> str:
"""Generate METADATA.toml for a given package.
Only add compatibility flags if they are different from default values:
python2 = false, python3 = true.
Note: the metadata should be generated per distribution, but we just use
an arbitrary package to populate it, since it should be the same for all
packages.
"""
version = known_versions.get(
package_to_distribution.get(package.name, package.name),
DEFAULT_VERSION,
)
lines = [f'version = "{version}"']
if package.py2_compatible or package.name in py2_packages:
# Note: for packages like six that appear in both normal and Python 2 only
# lists we force set python2 = true.
lines.append("python2 = true")
if not package.py3_compatible:
lines.append("python3 = false")
if package.requires:
distributions = [f'"types-{package_to_distribution.get(dep, dep)}"' for dep in package.requires]
lines.append(f"requires = [{', '.join(distributions)}]")
return "\n".join(lines)
def copy_third_party(packages: List[ThirdPartyPackage], py2_packages: List[ThirdPartyPackage]) -> None:
"""Refactor the third party part using collected metadata."""
third_party_dir = os.path.join(OUTPUT_DIR, THIRD_PARTY_NAMESPACE)
os.makedirs(third_party_dir, exist_ok=True)
# Note: these include Python 3 versions of packages like six.
for package in packages:
distribution = package_to_distribution.get(package.name, package.name)
distribution_dir = os.path.join(third_party_dir, distribution)
os.makedirs(distribution_dir, exist_ok=True)
metadata_file = os.path.join(distribution_dir, "METADATA.toml")
if not os.path.isfile(metadata_file):
# Write metadata once.
# TODO: check consistency between different packages in same distribution?
with open(metadata_file, "w") as f:
f.write(generate_metadata(package, [package.name for package in py2_packages]))
f.write("\n")
if not package.is_dir:
shutil.copy(package.path, distribution_dir)
else:
shutil.copytree(package.path, os.path.join(distribution_dir, package.name))
# Add Python 2 counterparts of packages like six (with different stubs) to nested
# namespaces like six/python2/six.
for package in py2_packages:
distribution = package_to_distribution.get(package.name, package.name)
distribution_dir = os.path.join(third_party_dir, distribution, PY2_NAMESPACE)
os.makedirs(distribution_dir, exist_ok=True)
if not package.is_dir:
shutil.copy(package.path, distribution_dir)
else:
shutil.copytree(package.path, os.path.join(distribution_dir, package.name))
def main() -> None:
# Collect metadata for Python 2 and 3, and Python 2 only standard library
# packages/modules. The latter will go to a separate nested namespace.
stdlib, py2_stdlib = collect_stdlib_packages()
third_party, py2_third_party = collect_third_party_packages()
# Collect standard library names to filter out from dependencies.
stdlib_names = [package.name for package in stdlib]
py2_stdlib_names = [package.name for package in py2_stdlib]
py2_stdlib_names += [package.name for package in stdlib if package.py_version == "2.7"]
# Collect all known distributions (for sanity checks).
known_distributions = {package_to_distribution.get(package.name, package.name) for package in third_party + py2_third_party}
# Compute dependencies between third party packages/modules to populate metadata.
for package in third_party + py2_third_party:
populate_requirements(package, stdlib_names, py2_stdlib_names, known_distributions)
# Copy the files to a separate location (to not clobber the root directory).
if not os.path.isdir(OUTPUT_DIR):
os.mkdir(OUTPUT_DIR)
copy_stdlib(stdlib, py2_stdlib)
copy_third_party(third_party, py2_third_party)
if __name__ == "__main__":
main()
-59
View File
@@ -1,59 +0,0 @@
#!/usr/bin/env python3
# This script removes lines from stubtest whitelists, according to
# an input file. The input file has one entry to remove per line.
# Each line consists of a whitelist filename and an entry, separated
# by a colon.
# This script is used by the workflow to remove unused whitelist entries.
import sys
from collections import defaultdict
from typing import Dict, List, Set, Tuple
def main() -> None:
if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} FILENAME", file=sys.stderr)
sys.exit(1)
to_remove = parse_input_file(sys.argv[1])
for filename, entries in to_remove.items():
remove_entries_from_whitelist(filename, entries)
def parse_input_file(input_file: str) -> Dict[str, Set[str]]:
to_remove = defaultdict(set)
with open(input_file) as f:
for filename, wl_entry in [parse_input_line(li) for li in f if li.strip()]:
to_remove[filename].add(wl_entry)
return to_remove
# Returns a (filename, entry) tuple.
def parse_input_line(line: str) -> Tuple[str, str]:
line = line.strip()
filename, entry = line.split(":", maxsplit=1)
return filename, entry
def remove_entries_from_whitelist(filename: str, entries: Set[str]) -> None:
new_lines: List[str] = []
with open(filename) as f:
for line in f:
entry = line.strip().split(" #")[0]
if entry in entries:
entries.remove(entry)
else:
new_lines.append(line)
if entries:
print(f"WARNING: The following entries were not found in '{filename}':", file=sys.stderr)
for entry in entries:
print(f" * {entry}")
with open(filename, "w") as f:
for line in new_lines:
f.write(line)
if __name__ == "__main__":
main()
+12 -6
View File
@@ -1,11 +1,14 @@
import mimetools
import SocketServer
# Stubs for BaseHTTPServer (Python 2.7)
from typing import Any, BinaryIO, Callable, Mapping, Optional, Tuple, Union
import SocketServer
import mimetools
class HTTPServer(SocketServer.TCPServer):
server_name: str
server_port: int
def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ...
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ...
class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
client_address: Tuple[str, int]
@@ -24,15 +27,18 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
protocol_version: str
MessageClass: type
responses: Mapping[int, Tuple[str, str]]
def __init__(self, request: bytes, client_address: Tuple[str, int], server: SocketServer.BaseServer) -> None: ...
def __init__(self, request: bytes, client_address: Tuple[str, int],
server: SocketServer.BaseServer) -> None: ...
def handle(self) -> None: ...
def handle_one_request(self) -> None: ...
def send_error(self, code: int, message: Optional[str] = ...) -> None: ...
def send_response(self, code: int, message: Optional[str] = ...) -> None: ...
def send_response(self, code: int,
message: Optional[str] = ...) -> None: ...
def send_header(self, keyword: str, value: str) -> None: ...
def end_headers(self) -> None: ...
def flush_headers(self) -> None: ...
def log_request(self, code: Union[int, str] = ..., size: Union[int, str] = ...) -> None: ...
def log_request(self, code: Union[int, str] = ...,
size: Union[int, str] = ...) -> None: ...
def log_error(self, format: str, *args: Any) -> None: ...
def log_message(self, format: str, *args: Any) -> None: ...
def version_string(self) -> str: ...
+3 -1
View File
@@ -1,5 +1,7 @@
import SimpleHTTPServer
# Stubs for CGIHTTPServer (Python 2.7)
from typing import List
import SimpleHTTPServer
class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
cgi_directories: List[str]
+6 -4
View File
@@ -1,5 +1,4 @@
from _typeshed import SupportsNoArgReadline
from typing import IO, Any, Dict, List, Optional, Sequence, Tuple, Union
from typing import Any, IO, Sequence, Tuple, Union, List, Dict, Protocol, Optional
DEFAULTSECT: str
MAX_INTERPOLATION_DEPTH: int
@@ -51,6 +50,9 @@ class MissingSectionHeaderError(ParsingError):
line: Any
def __init__(self, filename: str, lineno: Any, line: Any) -> None: ...
class _Readable(Protocol):
def readline(self) -> str: ...
class RawConfigParser:
_dict: Any
_sections: Dict[Any, Any]
@@ -66,7 +68,7 @@ class RawConfigParser:
def has_section(self, section: str) -> bool: ...
def options(self, section: str) -> List[str]: ...
def read(self, filenames: Union[str, Sequence[str]]) -> List[str]: ...
def readfp(self, fp: SupportsNoArgReadline[str], filename: str = ...) -> None: ...
def readfp(self, fp: _Readable, filename: str = ...) -> None: ...
def get(self, section: str, option: str) -> str: ...
def items(self, section: str) -> List[Tuple[Any, Any]]: ...
def _get(self, section: str, conv: type, option: str) -> Any: ...
@@ -93,5 +95,5 @@ 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[Any], rest: str, section: str, map: Dict[Any, Any], depth: int
self, option: str, accum: List[Any], rest: str, section: str, map: Dict[Any, Any], depth: int,
) -> None: ...
+5 -2
View File
@@ -1,5 +1,4 @@
from typing import AnyStr, List, Tuple
from typing import List, Tuple, AnyStr
from markupbase import ParserBase
class HTMLParser(ParserBase):
@@ -7,9 +6,11 @@ class HTMLParser(ParserBase):
def feed(self, feed: AnyStr) -> None: ...
def close(self) -> None: ...
def reset(self) -> None: ...
def get_starttag_text(self) -> AnyStr: ...
def set_cdata_mode(self, AnyStr) -> None: ...
def clear_cdata_mode(self) -> None: ...
def handle_startendtag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ...
def handle_starttag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ...
def handle_endtag(self, tag: AnyStr): ...
@@ -19,7 +20,9 @@ class HTMLParser(ParserBase):
def handle_comment(self, data: AnyStr): ...
def handle_decl(self, decl: AnyStr): ...
def handle_pi(self, data: AnyStr): ...
def unknown_decl(self, data: AnyStr): ...
def unescape(self, s: AnyStr) -> AnyStr: ...
class HTMLParseError(Exception):
+5 -3
View File
@@ -1,7 +1,9 @@
from collections import deque
from typing import Any, Deque, Generic, Optional, TypeVar
# Stubs for Queue (Python 2)
_T = TypeVar("_T")
from collections import deque
from typing import Any, Deque, TypeVar, Generic, Optional
_T = TypeVar('_T')
class Empty(Exception): ...
class Full(Exception): ...
+3 -1
View File
@@ -1,6 +1,8 @@
# Stubs for SimpleHTTPServer (Python 2)
from typing import Any, AnyStr, IO, Mapping, Optional, Union
import BaseHTTPServer
from StringIO import StringIO
from typing import IO, Any, AnyStr, Mapping, Optional, Union
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
server_version: str
+44 -60
View File
@@ -1,7 +1,10 @@
# NB: SocketServer.pyi and socketserver.pyi must remain consistent!
# Stubs for socketserver
from typing import Any, BinaryIO, Callable, Optional, Tuple, Type, Text, Union
from socket import SocketType
import sys
import types
from socket import SocketType
from typing import Any, BinaryIO, Callable, ClassVar, List, Optional, Text, Tuple, Type, Union
class BaseServer:
address_family: int
@@ -12,78 +15,66 @@ class BaseServer:
request_queue_size: int
socket_type: int
timeout: Optional[float]
def __init__(self, server_address: Any, RequestHandlerClass: Callable[..., BaseRequestHandler]) -> 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: ...
def shutdown(self) -> None: ...
def server_close(self) -> None: ...
def finish_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def get_request(self) -> Tuple[SocketType, Tuple[str, int]]: ...
def handle_error(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def finish_request(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
def get_request(self) -> None: ...
def handle_error(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
def handle_timeout(self) -> None: ...
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def process_request(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
def server_activate(self) -> None: ...
def server_bind(self) -> None: ...
def verify_request(self, request: bytes, client_address: Tuple[str, int]) -> bool: ...
def verify_request(self, request: bytes,
client_address: Tuple[str, int]) -> bool: ...
if sys.version_info >= (3, 6):
def __enter__(self) -> BaseServer: ...
def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
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: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...) -> None: ...
class UDPServer(BaseServer):
def __init__(
self,
server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...) -> None: ...
if sys.platform != "win32":
if sys.platform != 'win32':
class UnixStreamServer(BaseServer):
def __init__(
self,
server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
def __init__(self, server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...) -> None: ...
class UnixDatagramServer(BaseServer):
def __init__(
self,
server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
def __init__(self, server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...) -> None: ...
if sys.platform != "win32":
class ForkingMixIn:
timeout: Optional[float] # undocumented
active_children: Optional[List[int]] # undocumented
max_children: int # undocumented
def collect_children(self) -> None: ... # undocumented
def handle_timeout(self) -> None: ... # undocumented
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
class ThreadingMixIn:
daemon_threads: bool
def process_request_thread(self, request: bytes, client_address: Tuple[str, int]) -> None: ... # undocumented
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
if sys.platform != "win32":
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
class ForkingUDPServer(ForkingMixIn, UDPServer): ...
class ForkingMixIn: ...
class ThreadingMixIn: ...
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
class ForkingUDPServer(ForkingMixIn, UDPServer): ...
class ThreadingTCPServer(ThreadingMixIn, TCPServer): ...
class ThreadingUDPServer(ThreadingMixIn, UDPServer): ...
if sys.platform != "win32":
if sys.platform != 'win32':
class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): ...
class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): ...
class BaseRequestHandler:
# Those are technically of types, respectively:
# * Union[SocketType, Tuple[bytes, SocketType]]
@@ -93,23 +84,16 @@ class BaseRequestHandler:
# https://github.com/python/typeshed/pull/384#issuecomment-234649696)
request: Any
client_address: Any
server: BaseServer
def __init__(self, request: Any, client_address: Any, server: BaseServer) -> None: ...
def setup(self) -> None: ...
def handle(self) -> None: ...
def finish(self) -> None: ...
class StreamRequestHandler(BaseRequestHandler):
rbufsize: ClassVar[int] # Undocumented
wbufsize: ClassVar[int] # Undocumented
timeout: ClassVar[Optional[float]] # Undocumented
disable_nagle_algorithm: ClassVar[bool] # Undocumented
connection: SocketType # Undocumented
rfile: BinaryIO
wfile: BinaryIO
class DatagramRequestHandler(BaseRequestHandler):
packet: SocketType # Undocumented
socket: SocketType # Undocumented
rfile: BinaryIO
wfile: BinaryIO
+3 -1
View File
@@ -1,4 +1,6 @@
from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List, Optional
# Stubs for StringIO (Python 2)
from typing import Any, IO, AnyStr, Iterator, Iterable, Generic, List, Optional
class StringIO(IO[AnyStr], Generic[AnyStr]):
closed: bool
+11 -20
View File
@@ -1,35 +1,25 @@
from typing import (
Any,
Container,
Dict,
Generic,
Iterable,
Iterator,
List,
Mapping,
Optional,
Sized,
Tuple,
TypeVar,
Union,
overload,
)
from typing import (Any, Container, Dict, Generic, Iterable, Iterator, List,
Mapping, Optional, Sized, Tuple, TypeVar, Union, overload)
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_T = TypeVar("_T")
_KT = TypeVar('_KT')
_VT = TypeVar('_VT')
_T = TypeVar('_T')
class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
data: Dict[_KT, _VT]
def __init__(self, initialdata: Mapping[_KT, _VT] = ...) -> None: ...
# TODO: __iter__ is not available for UserDict
class IterableUserDict(UserDict[_KT, _VT], Generic[_KT, _VT]): ...
class IterableUserDict(UserDict[_KT, _VT], Generic[_KT, _VT]):
...
class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]):
def has_key(self, key: _KT) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_KT]: ...
# From typing.Mapping[_KT, _VT]
# (can't inherit because of keys())
@overload
@@ -42,6 +32,7 @@ class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]):
def itervalues(self) -> Iterator[_VT]: ...
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
def __contains__(self, o: Any) -> bool: ...
# From typing.MutableMapping[_KT, _VT]
def clear(self) -> None: ...
def pop(self, k: _KT, default: _VT = ...) -> _VT: ...
+1 -1
View File
@@ -1,4 +1,4 @@
from typing import Iterable, List, MutableSequence, TypeVar, Union, overload
from typing import Iterable, MutableSequence, TypeVar, Union, overload, List
_T = TypeVar("_T")
_S = TypeVar("_S")
+1 -1
View File
@@ -1,5 +1,5 @@
import collections
from typing import Any, Iterable, List, MutableSequence, Optional, Sequence, Text, Tuple, TypeVar, Union, overload
from typing import Any, Iterable, List, MutableSequence, Sequence, Optional, overload, Text, TypeVar, Tuple, Union
_UST = TypeVar("_UST", bound=UserString)
_MST = TypeVar("_MST", bound=MutableString)
+1057 -594
View File
File diff suppressed because it is too large Load Diff
+35 -8
View File
@@ -10,7 +10,8 @@ class AST:
_fields: typing.Tuple[str, ...]
def __init__(self, *args, **kwargs) -> None: ...
class mod(AST): ...
class mod(AST):
...
class Module(mod):
body: typing.List[stmt]
@@ -24,6 +25,7 @@ class Expression(mod):
class Suite(mod):
body: typing.List[stmt]
class stmt(AST):
lineno: int
col_offset: int
@@ -121,7 +123,10 @@ class Expr(stmt):
class Pass(stmt): ...
class Break(stmt): ...
class Continue(stmt): ...
class slice(AST): ...
class slice(AST):
...
_slice = slice # this lets us type the variable named 'slice' below
@@ -138,6 +143,7 @@ class Index(slice):
class Ellipsis(slice): ...
class expr(AST):
lineno: int
col_offset: int
@@ -234,17 +240,27 @@ class Tuple(expr):
elts: typing.List[expr]
ctx: expr_context
class expr_context(AST): ...
class expr_context(AST):
...
class AugLoad(expr_context): ...
class AugStore(expr_context): ...
class Del(expr_context): ...
class Load(expr_context): ...
class Param(expr_context): ...
class Store(expr_context): ...
class boolop(AST): ...
class boolop(AST):
...
class And(boolop): ...
class Or(boolop): ...
class operator(AST): ...
class operator(AST):
...
class Add(operator): ...
class BitAnd(operator): ...
class BitOr(operator): ...
@@ -257,12 +273,18 @@ class Mult(operator): ...
class Pow(operator): ...
class RShift(operator): ...
class Sub(operator): ...
class unaryop(AST): ...
class unaryop(AST):
...
class Invert(unaryop): ...
class Not(unaryop): ...
class UAdd(unaryop): ...
class USub(unaryop): ...
class cmpop(AST): ...
class cmpop(AST):
...
class Eq(cmpop): ...
class Gt(cmpop): ...
class GtE(cmpop): ...
@@ -274,12 +296,16 @@ class LtE(cmpop): ...
class NotEq(cmpop): ...
class NotIn(cmpop): ...
class comprehension(AST):
target: expr
iter: expr
ifs: typing.List[expr]
class excepthandler(AST): ...
class excepthandler(AST):
...
class ExceptHandler(excepthandler):
type: Optional[expr]
@@ -288,6 +314,7 @@ class ExceptHandler(excepthandler):
lineno: int
col_offset: int
class arguments(AST):
args: typing.List[expr]
vararg: Optional[_identifier]
+5 -3
View File
@@ -1,9 +1,11 @@
from typing import Any, Callable, Dict, Generic, Iterator, Optional, TypeVar, Union
"""Stub file for the '_collections' module."""
from typing import Any, Callable, Dict, Generic, Iterator, TypeVar, Optional, Union
_K = TypeVar("_K")
_V = TypeVar("_V")
_T = TypeVar("_T")
_T2 = TypeVar("_T2")
_T = TypeVar('_T')
_T2 = TypeVar('_T2')
class defaultdict(Dict[_K, _V]):
default_factory: None
+8 -3
View File
@@ -1,11 +1,16 @@
from typing import Any, Callable, Dict, Iterable, Optional, Tuple, TypeVar, overload
"""Stub file for the '_functools' module."""
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Tuple, overload
_T = TypeVar("_T")
_S = TypeVar("_S")
@overload
def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ...
def reduce(function: Callable[[_T, _T], _T],
sequence: Iterable[_T]) -> _T: ...
@overload
def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ...
def reduce(function: Callable[[_T, _S], _T],
sequence: Iterable[_S], initial: _T) -> _T: ...
class partial(object):
func: Callable[..., Any]
+6 -1
View File
@@ -1,4 +1,9 @@
from typing import Any, Dict, Generic, List, Tuple
"""Stub file for the '_hotshot' 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 coverage(a: str) -> Any: ...
def logreader(a: str) -> LogReaderType: ...
+22 -20
View File
@@ -1,6 +1,6 @@
from typing import Any, AnyStr, BinaryIO, IO, Text, TextIO, Iterable, Iterator, List, Optional, Type, Tuple, TypeVar, Union
from mmap import mmap
from types import TracebackType
from typing import IO, Any, AnyStr, BinaryIO, Iterable, Iterator, List, Optional, Text, TextIO, Tuple, Type, TypeVar, Union
_bytearray_like = Union[bytearray, mmap]
@@ -32,9 +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]
) -> Optional[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: ...
@@ -55,7 +53,8 @@ class _BufferedIOBase(_IOBase):
def detach(self) -> _IOBase: ...
class BufferedRWPair(_BufferedIOBase):
def __init__(self, reader: _RawIOBase, writer: _RawIOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
def __init__(self, reader: _RawIOBase, writer: _RawIOBase,
buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
def peek(self, n: int = ...) -> bytes: ...
def __enter__(self) -> BufferedRWPair: ...
@@ -63,7 +62,9 @@ class BufferedRandom(_BufferedIOBase):
mode: str
name: str
raw: _IOBase
def __init__(self, raw: _IOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
def __init__(self, raw: _IOBase,
buffer_size: int = ...,
max_buffer_size: int = ...) -> None: ...
def peek(self, n: int = ...) -> bytes: ...
class BufferedReader(_BufferedIOBase):
@@ -77,7 +78,9 @@ class BufferedWriter(_BufferedIOBase):
name: str
raw: _IOBase
mode: str
def __init__(self, raw: _IOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
def __init__(self, raw: _IOBase,
buffer_size: int = ...,
max_buffer_size: int = ...) -> None: ...
class BytesIO(_BufferedIOBase):
def __init__(self, initial_bytes: bytes = ...) -> None: ...
@@ -112,6 +115,7 @@ class IncrementalNewlineDecoder(object):
def setstate(self, state: Tuple[Any, int]) -> None: ...
def reset(self) -> None: ...
# Note: In the actual _io.py, _TextIOBase inherits from _IOBase.
class _TextIOBase(TextIO):
errors: Optional[str]
@@ -142,14 +146,14 @@ 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]
) -> Optional[bool]: ...
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> Optional[bool]: ...
def __iter__(self: _T) -> _T: ...
class StringIO(_TextIOBase):
line_buffering: bool
def __init__(self, initial_value: Optional[unicode] = ..., newline: Optional[unicode] = ...) -> None: ...
def __init__(self,
initial_value: Optional[unicode] = ...,
newline: Optional[unicode] = ...) -> None: ...
def __setstate__(self, state: Tuple[Any, ...]) -> None: ...
def __getstate__(self) -> Tuple[Any, ...]: ...
# StringIO does not contain a "name" field. This workaround is necessary
@@ -173,12 +177,10 @@ class TextIOWrapper(_TextIOBase):
write_through: bool = ...,
) -> None: ...
def open(
file: Union[str, unicode, int],
mode: Text = ...,
buffering: int = ...,
encoding: Optional[Text] = ...,
errors: Optional[Text] = ...,
newline: Optional[Text] = ...,
closefd: bool = ...,
) -> IO[Any]: ...
def open(file: Union[str, unicode, int],
mode: Text = ...,
buffering: int = ...,
encoding: Optional[Text] = ...,
errors: Optional[Text] = ...,
newline: Optional[Text] = ...,
closefd: bool = ...) -> IO[Any]: ...
+1 -1
View File
@@ -1,4 +1,4 @@
from typing import Any, Dict, Generic, List, Tuple
from typing import Any, List, Tuple, Dict, Generic, Tuple
def encode_basestring_ascii(*args, **kwargs) -> str: ...
def scanstring(a, b, *args, **kwargs) -> Tuple[Any, ...]: ...
+4 -2
View File
@@ -1,4 +1,4 @@
from typing import IO, Any, Optional, Tuple, Union, overload
from typing import Tuple, Union, IO, Any, Optional, overload
AF_APPLETALK: int
AF_ASH: int
@@ -251,6 +251,7 @@ class SocketType(object):
type: int
proto: int
timeout: float
def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ...
def accept(self) -> Tuple[SocketType, Tuple[Any, ...]]: ...
def bind(self, address: Tuple[Any, ...]) -> None: ...
@@ -268,7 +269,8 @@ class SocketType(object):
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[Any, ...]: ...
def recvfrom_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ...
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
+5 -1
View File
@@ -1,4 +1,6 @@
from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union, overload
"""Stub file for the '_sre' module."""
from typing import Any, Union, Iterable, Optional, Mapping, Sequence, Dict, List, Tuple, overload
CODESIZE: int
MAGIC: int
@@ -47,5 +49,7 @@ def compile(
groupindex: Mapping[str, int] = ...,
indexgroup: Sequence[int] = ...,
) -> SRE_Pattern: ...
def getcodesize() -> int: ...
def getlower(a: int, b: int) -> int: ...
+3
View File
@@ -1,3 +1,5 @@
"""Stub file for the '_struct' module."""
from typing import Any, AnyStr, Tuple
class error(Exception): ...
@@ -5,6 +7,7 @@ class error(Exception): ...
class Struct(object):
size: int
format: str
def __init__(self, fmt: str) -> None: ...
def pack_into(self, buffer: bytearray, offset: int, obj: Any) -> None: ...
def pack(self, *args) -> str: ...
+4 -2
View File
@@ -1,4 +1,4 @@
from typing import Dict, List
from typing import List, Dict
CELL: int
DEF_BOUND: int
@@ -22,7 +22,8 @@ TYPE_FUNCTION: int
TYPE_MODULE: int
USE: int
class _symtable_entry(object): ...
class _symtable_entry(object):
...
class symtable(object):
children: List[_symtable_entry]
@@ -34,4 +35,5 @@ class symtable(object):
symbols: Dict[str, int]
type: int
varnames: List[str]
def __init__(self, src: str, filename: str, startstr: str) -> None: ...
+1
View File
@@ -1,3 +1,4 @@
# Source: https://hg.python.org/cpython/file/2.7/Lib/_threading_local.py
from typing import Any
class _localbase(object): ...
-97
View File
@@ -1,97 +0,0 @@
import sys
from types import TracebackType
from typing import Any, Optional, Tuple, Type, Union
_KeyType = Union[HKEYType, int]
def CloseKey(__hkey: _KeyType) -> None: ...
def ConnectRegistry(__computer_name: Optional[str], __key: _KeyType) -> HKEYType: ...
def CreateKey(__key: _KeyType, __sub_key: Optional[str]) -> HKEYType: ...
def CreateKeyEx(key: _KeyType, sub_key: Optional[str], reserved: int = ..., access: int = ...) -> HKEYType: ...
def DeleteKey(__key: _KeyType, __sub_key: str) -> None: ...
def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = ..., reserved: int = ...) -> None: ...
def DeleteValue(__key: _KeyType, __value: str) -> None: ...
def EnumKey(__key: _KeyType, __index: int) -> str: ...
def EnumValue(__key: _KeyType, __index: int) -> Tuple[str, Any, int]: ...
def ExpandEnvironmentStrings(__str: str) -> str: ...
def FlushKey(__key: _KeyType) -> None: ...
def LoadKey(__key: _KeyType, __sub_key: str, __file_name: str) -> None: ...
def OpenKey(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ...
def OpenKeyEx(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ...
def QueryInfoKey(__key: _KeyType) -> Tuple[int, int, int]: ...
def QueryValue(__key: _KeyType, __sub_key: Optional[str]) -> str: ...
def QueryValueEx(__key: _KeyType, __name: str) -> Tuple[Any, int]: ...
def SaveKey(__key: _KeyType, __file_name: str) -> None: ...
def SetValue(__key: _KeyType, __sub_key: str, __type: int, __value: str) -> None: ...
def SetValueEx(
__key: _KeyType, __value_name: Optional[str], __reserved: Any, __type: int, __value: Union[str, int]
) -> None: ... # reserved is ignored
def DisableReflectionKey(__key: _KeyType) -> None: ...
def EnableReflectionKey(__key: _KeyType) -> None: ...
def QueryReflectionKey(__key: _KeyType) -> bool: ...
HKEY_CLASSES_ROOT: int
HKEY_CURRENT_USER: int
HKEY_LOCAL_MACHINE: int
HKEY_USERS: int
HKEY_PERFORMANCE_DATA: int
HKEY_CURRENT_CONFIG: int
HKEY_DYN_DATA: int
KEY_ALL_ACCESS: int
KEY_WRITE: int
KEY_READ: int
KEY_EXECUTE: int
KEY_QUERY_VALUE: int
KEY_SET_VALUE: int
KEY_CREATE_SUB_KEY: int
KEY_ENUMERATE_SUB_KEYS: int
KEY_NOTIFY: int
KEY_CREATE_LINK: int
KEY_WOW64_64KEY: int
KEY_WOW64_32KEY: int
REG_BINARY: int
REG_DWORD: int
REG_DWORD_LITTLE_ENDIAN: int
REG_DWORD_BIG_ENDIAN: int
REG_EXPAND_SZ: int
REG_LINK: int
REG_MULTI_SZ: int
REG_NONE: int
REG_RESOURCE_LIST: int
REG_FULL_RESOURCE_DESCRIPTOR: int
REG_RESOURCE_REQUIREMENTS_LIST: int
REG_SZ: int
REG_CREATED_NEW_KEY: int # undocumented
REG_LEGAL_CHANGE_FILTER: int # undocumented
REG_LEGAL_OPTION: int # undocumented
REG_NOTIFY_CHANGE_ATTRIBUTES: int # undocumented
REG_NOTIFY_CHANGE_LAST_SET: int # undocumented
REG_NOTIFY_CHANGE_NAME: int # undocumented
REG_NOTIFY_CHANGE_SECURITY: int # undocumented
REG_NO_LAZY_FLUSH: int # undocumented
REG_OPENED_EXISTING_KEY: int # undocumented
REG_OPTION_BACKUP_RESTORE: int # undocumented
REG_OPTION_CREATE_LINK: int # undocumented
REG_OPTION_NON_VOLATILE: int # undocumented
REG_OPTION_OPEN_LINK: int # undocumented
REG_OPTION_RESERVED: int # undocumented
REG_OPTION_VOLATILE: int # undocumented
REG_REFRESH_HIVE: int # undocumented
REG_WHOLE_HIVE_VOLATILE: int # undocumented
error = OSError
# Though this class has a __name__ of PyHKEY, it's exposed as HKEYType for some reason
class HKEYType:
def __bool__(self) -> bool: ...
def __int__(self) -> int: ...
def __enter__(self) -> HKEYType: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
def Close(self) -> None: ...
def Detach(self) -> int: ...
+2 -2
View File
@@ -1,7 +1,7 @@
import _weakrefset
from typing import Any, Callable, Dict, Set, Tuple, Type, TypeVar
import _weakrefset
_FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
_FuncT = TypeVar('_FuncT', bound=Callable[..., Any])
# NOTE: mypy has special processing for ABCMeta and abstractmethod.
+1 -1
View File
@@ -20,7 +20,7 @@ def iter_fields(node: AST) -> Iterator[_typing.Tuple[str, Any]]: ...
def literal_eval(node_or_string: Union[str, unicode, AST]) -> Any: ...
def walk(node: AST) -> Iterator[AST]: ...
class NodeVisitor:
class NodeVisitor():
def visit(self, node: AST) -> Any: ...
def generic_visit(self, node: AST) -> Any: ...
+2 -2
View File
@@ -1,5 +1,5 @@
from typing import Any, TypeVar
from typing import TypeVar, Any
_FT = TypeVar("_FT")
_FT = TypeVar('_FT')
def register(func: _FT, *args: Any, **kargs: Any) -> _FT: ...
File diff suppressed because it is too large Load Diff
+7 -1
View File
@@ -1,4 +1,4 @@
from typing import IO, Any, List
from typing import Any, IO, List
HIGHEST_PROTOCOL: int
compatible_formats: List[str]
@@ -6,14 +6,20 @@ format_version: str
class Pickler:
def __init__(self, file: IO[str], protocol: int = ...) -> None: ...
def dump(self, obj: Any) -> None: ...
def clear_memo(self) -> None: ...
class Unpickler:
def __init__(self, file: IO[str]) -> None: ...
def load(self) -> Any: ...
def noload(self) -> Any: ...
def dump(obj: Any, file: IO[str], protocol: int = ...) -> None: ...
def dumps(obj: Any, protocol: int = ...) -> str: ...
def load(file: IO[str]) -> Any: ...
+7 -1
View File
@@ -1,6 +1,11 @@
# Stubs for cStringIO (Python 2.7)
# See https://docs.python.org/2/library/stringio.html
from abc import ABCMeta
from typing import overload, IO, List, Iterable, Iterator, Optional, Union
from types import TracebackType
from typing import IO, Iterable, Iterator, List, Optional, Union, overload
# TODO the typing.IO[] generics should be split into input and output.
# This class isn't actually abstract, but you can't instantiate it
# directly, so we might as well treat it as abstract in the stub.
@@ -21,6 +26,7 @@ class InputType(IO[str], Iterator[str], metaclass=ABCMeta):
def next(self) -> str: ...
def reset(self) -> None: ...
class OutputType(IO[str], Iterator[str], metaclass=ABCMeta):
@property
def softspace(self) -> int: ...
+23 -32
View File
@@ -1,50 +1,38 @@
# These are not exported.
from typing import Any, Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible
# These are exported.
from typing import (
AbstractSet,
Any,
Callable as Callable,
Container as Container,
Dict,
Generic,
Hashable as Hashable,
ItemsView as ItemsView,
Iterable as Iterable,
Iterator as Iterator,
KeysView as KeysView,
List,
Mapping as Mapping,
MappingView as MappingView,
MutableMapping as MutableMapping,
MutableSequence as MutableSequence,
MutableSet as MutableSet,
Optional,
Reversible,
Sequence as Sequence,
AbstractSet as Set,
Sized as Sized,
Tuple,
Type,
TypeVar,
Union,
ValuesView as ValuesView,
overload,
)
Set = AbstractSet
_S = TypeVar("_S")
_T = TypeVar("_T")
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_S = TypeVar('_S')
_T = TypeVar('_T')
_KT = TypeVar('_KT')
_VT = TypeVar('_VT')
# namedtuple is special-cased in the type checker; the initializer is ignored.
def namedtuple(
typename: Union[str, unicode],
field_names: Union[str, unicode, Iterable[Union[str, unicode]]],
verbose: bool = ...,
rename: bool = ...,
) -> Type[Tuple[Any, ...]]: ...
def namedtuple(typename: Union[str, unicode], field_names: Union[str, unicode, Iterable[Union[str, unicode]]],
verbose: bool = ..., rename: bool = ...) -> Type[Tuple[Any, ...]]: ...
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ..., maxlen: int = ...) -> None: ...
def __init__(self, iterable: Iterable[_T] = ...,
maxlen: int = ...) -> None: ...
@property
def maxlen(self) -> Optional[int]: ...
def append(self, x: _T) -> None: ...
@@ -57,7 +45,7 @@ class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
def popleft(self) -> _T: ...
def remove(self, value: _T) -> None: ...
def reverse(self) -> None: ...
def rotate(self, n: int = ...) -> None: ...
def rotate(self, n: int) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
@@ -93,6 +81,7 @@ class Counter(Dict[_T, int], Generic[_T]):
def update(self, __m: Union[Iterable[_T], Iterable[Tuple[_T, int]]], **kwargs: int) -> None: ...
@overload
def update(self, **kwargs: int) -> None: ...
def __add__(self, other: Counter[_T]) -> Counter[_T]: ...
def __sub__(self, other: Counter[_T]) -> Counter[_T]: ...
def __and__(self, other: Counter[_T]) -> Counter[_T]: ...
@@ -116,14 +105,16 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], **kwargs: _VT) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT]) -> None: ...
def __init__(self, default_factory: Optional[Callable[[], _VT]],
map: Mapping[_KT, _VT]) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
def __init__(self, default_factory: Optional[Callable[[], _VT]],
map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
def __init__(self, default_factory: Optional[Callable[[], _VT]],
iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
@overload
def __init__(
self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT
) -> None: ...
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: _S) -> _S: ...
+3 -1
View File
@@ -1,10 +1,12 @@
from typing import AnyStr, Text, Tuple, overload
from typing import overload, AnyStr, Text, Tuple
def getstatus(file: Text) -> str: ...
def getoutput(cmd: Text) -> str: ...
def getstatusoutput(cmd: Text) -> Tuple[int, str]: ...
@overload
def mk2arg(head: bytes, x: bytes) -> bytes: ...
@overload
def mk2arg(head: Text, x: Text) -> Text: ...
def mkarg(x: AnyStr) -> AnyStr: ...
+8 -5
View File
@@ -1,16 +1,19 @@
from _typeshed import AnyPath
from typing import Any, Optional, Pattern
# Stubs for compileall (Python 2)
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: AnyPath,
dir: _Path,
maxlevels: int = ...,
ddir: Optional[AnyPath] = ...,
ddir: Optional[_Path] = ...,
force: bool = ...,
rx: Optional[Pattern[Any]] = ...,
quiet: int = ...,
) -> int: ...
def compile_file(
fullname: AnyPath, ddir: Optional[AnyPath] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...
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: ...
+6 -36
View File
@@ -17,26 +17,8 @@ class Cookie:
comment: Any
comment_url: Any
rfc2109: Any
def __init__(
self,
version,
name,
value,
port,
port_specified,
domain,
domain_specified,
domain_initial_dot,
path,
path_specified,
secure,
expires,
discard,
comment,
comment_url,
rest,
rfc2109: bool = ...,
): ...
def __init__(self, version, name, value, port, port_specified, domain, domain_specified, domain_initial_dot, path,
path_specified, secure, expires, discard, comment, comment_url, rest, rfc2109: bool = ...): ...
def has_nonstandard_attr(self, name): ...
def get_nonstandard_attr(self, name, default: Optional[Any] = ...): ...
def set_nonstandard_attr(self, name, value): ...
@@ -64,21 +46,10 @@ class DefaultCookiePolicy(CookiePolicy):
strict_ns_domain: Any
strict_ns_set_initial_dollar: Any
strict_ns_set_path: Any
def __init__(
self,
blocked_domains: Optional[Any] = ...,
allowed_domains: Optional[Any] = ...,
netscape: bool = ...,
rfc2965: bool = ...,
rfc2109_as_netscape: Optional[Any] = ...,
hide_cookie2: bool = ...,
strict_domain: bool = ...,
strict_rfc2965_unverifiable: bool = ...,
strict_ns_unverifiable: bool = ...,
strict_ns_domain=...,
strict_ns_set_initial_dollar: bool = ...,
strict_ns_set_path: bool = ...,
): ...
def __init__(self, blocked_domains: Optional[Any] = ..., allowed_domains: Optional[Any] = ..., netscape: bool = ...,
rfc2965: bool = ..., rfc2109_as_netscape: Optional[Any] = ..., hide_cookie2: bool = ...,
strict_domain: bool = ..., strict_rfc2965_unverifiable: bool = ..., strict_ns_unverifiable: bool = ...,
strict_ns_domain=..., strict_ns_set_initial_dollar: bool = ..., strict_ns_set_path: bool = ...): ...
def blocked_domains(self): ...
def set_blocked_domains(self, blocked_domains): ...
def is_blocked(self, domain): ...
@@ -138,5 +109,4 @@ class LWPCookieJar(FileCookieJar):
def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented
MozillaCookieJar = FileCookieJar
def lwp_cookie_str(cookie: Cookie) -> str: ...
+4 -6
View File
@@ -1,15 +1,13 @@
from typing import Any, Callable, Hashable, List, Optional, SupportsInt, Tuple, TypeVar, Union
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 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: ...
+2
View File
@@ -1,3 +1,5 @@
# Source: https://hg.python.org/cpython/file/2.7/Lib/dircache.py
from typing import List, MutableSequence, Text, Union
def reset() -> None: ...
-12
View File
@@ -1,12 +0,0 @@
from typing import Optional
def make_archive(
base_name: str,
format: str,
root_dir: Optional[str] = ...,
base_dir: Optional[str] = ...,
verbose: int = ...,
dry_run: int = ...,
) -> str: ...
def make_tarball(base_name: str, base_dir: str, compress: Optional[str] = ..., verbose: int = ..., dry_run: int = ...) -> str: ...
def make_zipfile(base_name: str, base_dir: str, verbose: int = ..., dry_run: int = ...) -> str: ...
-150
View File
@@ -1,150 +0,0 @@
from typing import Any, Callable, List, Optional, Tuple, Union
_Macro = Union[Tuple[str], Tuple[str, Optional[str]]]
def gen_lib_options(
compiler: CCompiler, library_dirs: List[str], runtime_library_dirs: List[str], libraries: List[str]
) -> List[str]: ...
def gen_preprocess_options(macros: List[_Macro], include_dirs: List[str]) -> List[str]: ...
def get_default_compiler(osname: Optional[str] = ..., platform: Optional[str] = ...) -> str: ...
def new_compiler(
plat: Optional[str] = ..., compiler: Optional[str] = ..., verbose: int = ..., dry_run: int = ..., force: int = ...
) -> CCompiler: ...
def show_compilers() -> None: ...
class CCompiler:
dry_run: bool
force: bool
verbose: bool
output_dir: Optional[str]
macros: List[_Macro]
include_dirs: List[str]
libraries: List[str]
library_dirs: List[str]
runtime_library_dirs: List[str]
objects: List[str]
def __init__(self, verbose: int = ..., dry_run: int = ..., force: int = ...) -> None: ...
def add_include_dir(self, dir: str) -> None: ...
def set_include_dirs(self, dirs: List[str]) -> None: ...
def add_library(self, libname: str) -> None: ...
def set_libraries(self, libnames: List[str]) -> None: ...
def add_library_dir(self, dir: str) -> None: ...
def set_library_dirs(self, dirs: List[str]) -> None: ...
def add_runtime_library_dir(self, dir: str) -> None: ...
def set_runtime_library_dirs(self, dirs: List[str]) -> None: ...
def define_macro(self, name: str, value: Optional[str] = ...) -> None: ...
def undefine_macro(self, name: str) -> None: ...
def add_link_object(self, object: str) -> None: ...
def set_link_objects(self, objects: List[str]) -> None: ...
def detect_language(self, sources: Union[str, List[str]]) -> Optional[str]: ...
def find_library_file(self, dirs: List[str], lib: str, debug: bool = ...) -> Optional[str]: ...
def has_function(
self,
funcname: str,
includes: Optional[List[str]] = ...,
include_dirs: Optional[List[str]] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
) -> bool: ...
def library_dir_option(self, dir: str) -> str: ...
def library_option(self, lib: str) -> str: ...
def runtime_library_dir_option(self, dir: str) -> str: ...
def set_executables(self, **args: str) -> None: ...
def compile(
self,
sources: List[str],
output_dir: Optional[str] = ...,
macros: Optional[_Macro] = ...,
include_dirs: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
depends: Optional[List[str]] = ...,
) -> List[str]: ...
def create_static_lib(
self,
objects: List[str],
output_libname: str,
output_dir: Optional[str] = ...,
debug: bool = ...,
target_lang: Optional[str] = ...,
) -> None: ...
def link(
self,
target_desc: str,
objects: List[str],
output_filename: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
) -> None: ...
def link_executable(
self,
objects: List[str],
output_progname: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
target_lang: Optional[str] = ...,
) -> None: ...
def link_shared_lib(
self,
objects: List[str],
output_libname: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
) -> None: ...
def link_shared_object(
self,
objects: List[str],
output_filename: str,
output_dir: Optional[str] = ...,
libraries: Optional[List[str]] = ...,
library_dirs: Optional[List[str]] = ...,
runtime_library_dirs: Optional[List[str]] = ...,
export_symbols: Optional[List[str]] = ...,
debug: bool = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
build_temp: Optional[str] = ...,
target_lang: Optional[str] = ...,
) -> None: ...
def preprocess(
self,
source: str,
output_file: Optional[str] = ...,
macros: Optional[List[_Macro]] = ...,
include_dirs: Optional[List[str]] = ...,
extra_preargs: Optional[List[str]] = ...,
extra_postargs: Optional[List[str]] = ...,
) -> None: ...
def executable_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ...
def library_filename(self, libname: str, lib_type: str = ..., strip_dir: int = ..., output_dir: str = ...) -> str: ...
def object_filenames(self, source_filenames: List[str], strip_dir: int = ..., output_dir: str = ...) -> List[str]: ...
def shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ...
def execute(self, func: Callable[..., None], args: Tuple[Any, ...], msg: Optional[str] = ..., level: int = ...) -> None: ...
def spawn(self, cmd: List[str]) -> None: ...
def mkpath(self, name: str, mode: int = ...) -> None: ...
def move_file(self, src: str, dst: str) -> str: ...
def announce(self, msg: str, level: int = ...) -> None: ...
def warn(self, msg: str) -> None: ...
def debug_print(self, msg: str) -> None: ...
-6
View File
@@ -1,6 +0,0 @@
from distutils.cmd import Command
class build_py(Command):
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...
-87
View File
@@ -1,87 +0,0 @@
from distutils import log as log
from distutils.ccompiler import CCompiler
from distutils.core import Command as Command
from distutils.errors import DistutilsExecError as DistutilsExecError
from distutils.sysconfig import customize_compiler as customize_compiler
from typing import Dict, List, Optional, Pattern, Sequence, Tuple, Union
LANG_EXT: Dict[str, str]
class config(Command):
description: str = ...
# Tuple is full name, short name, description
user_options: Sequence[Tuple[str, Optional[str], str]] = ...
compiler: Optional[Union[str, CCompiler]] = ...
cc: Optional[str] = ...
include_dirs: Optional[Sequence[str]] = ...
libraries: Optional[Sequence[str]] = ...
library_dirs: Optional[Sequence[str]] = ...
noisy: int = ...
dump_source: int = ...
temp_files: Sequence[str] = ...
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...
def try_cpp(
self,
body: Optional[str] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def search_cpp(
self,
pattern: Union[Pattern[str], str],
body: Optional[str] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def try_compile(
self, body: str, headers: Optional[Sequence[str]] = ..., include_dirs: Optional[Sequence[str]] = ..., lang: str = ...
) -> bool: ...
def try_link(
self,
body: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def try_run(
self,
body: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def check_func(
self,
func: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
decl: int = ...,
call: int = ...,
) -> bool: ...
def check_lib(
self,
library: str,
library_dirs: Optional[Sequence[str]] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
other_libraries: List[str] = ...,
) -> bool: ...
def check_header(
self,
header: str,
include_dirs: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def dump_file(filename: str, head: Optional[str] = ...) -> None: ...
@@ -1,10 +0,0 @@
from distutils.cmd import Command
from typing import ClassVar, List, Optional, Tuple
class install_egg_info(Command):
description: ClassVar[str]
user_options: ClassVar[List[Tuple[str, Optional[str], str]]]
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...
def get_outputs(self) -> List[str]: ...
-8
View File
@@ -1,8 +0,0 @@
from distutils.config import PyPIRCCommand
from typing import ClassVar, List, Optional, Tuple
class upload(PyPIRCCommand):
description: ClassVar[str]
boolean_options: ClassVar[List[str]]
def run(self) -> None: ...
def upload_file(self, command, pyversion, filename) -> None: ...
-17
View File
@@ -1,17 +0,0 @@
from abc import abstractmethod
from distutils.cmd import Command
from typing import ClassVar, List, Optional, Tuple
DEFAULT_PYPIRC: str
class PyPIRCCommand(Command):
DEFAULT_REPOSITORY: ClassVar[str]
DEFAULT_REALM: ClassVar[str]
repository: None
realm: None
user_options: ClassVar[List[Tuple[str, Optional[str], str]]]
boolean_options: ClassVar[List[str]]
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
@abstractmethod
def run(self) -> None: ...
-48
View File
@@ -1,48 +0,0 @@
from distutils.cmd import Command as Command
from distutils.dist import Distribution as Distribution
from distutils.extension import Extension as Extension
from typing import Any, List, Mapping, Optional, Tuple, Type, Union
def setup(
*,
name: str = ...,
version: str = ...,
description: str = ...,
long_description: str = ...,
author: str = ...,
author_email: str = ...,
maintainer: str = ...,
maintainer_email: str = ...,
url: str = ...,
download_url: str = ...,
packages: List[str] = ...,
py_modules: List[str] = ...,
scripts: List[str] = ...,
ext_modules: List[Extension] = ...,
classifiers: List[str] = ...,
distclass: Type[Distribution] = ...,
script_name: str = ...,
script_args: List[str] = ...,
options: Mapping[str, Any] = ...,
license: str = ...,
keywords: Union[List[str], str] = ...,
platforms: Union[List[str], str] = ...,
cmdclass: Mapping[str, Type[Command]] = ...,
data_files: List[Tuple[str, List[str]]] = ...,
package_dir: Mapping[str, str] = ...,
obsoletes: List[str] = ...,
provides: List[str] = ...,
requires: List[str] = ...,
command_packages: List[str] = ...,
command_options: Mapping[str, Mapping[str, Tuple[Any, Any]]] = ...,
package_data: Mapping[str, List[str]] = ...,
include_package_data: bool = ...,
libraries: List[str] = ...,
headers: List[str] = ...,
ext_package: str = ...,
include_dirs: List[str] = ...,
password: str = ...,
fullname: str = ...,
**attrs: Any,
) -> None: ...
def run_setup(script_name: str, script_args: Optional[List[str]] = ..., stop_after: str = ...) -> Distribution: ...
-4
View File
@@ -1,4 +0,0 @@
from distutils.unixccompiler import UnixCCompiler
class CygwinCCompiler(UnixCCompiler): ...
class Mingw32CCompiler(CygwinCCompiler): ...
-1
View File
@@ -1 +0,0 @@
DEBUG: bool
-5
View File
@@ -1,5 +0,0 @@
from typing import List, Tuple
def newer(source: str, target: str) -> bool: ...
def newer_pairwise(sources: List[str], targets: List[str]) -> List[Tuple[str, str]]: ...
def newer_group(sources: List[str], target: str, missing: str = ...) -> bool: ...
-15
View File
@@ -1,15 +0,0 @@
from typing import List
def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> List[str]: ...
def create_tree(base_dir: str, files: List[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ...
def copy_tree(
src: str,
dst: str,
preserve_mode: int = ...,
preserve_times: int = ...,
preserve_symlinks: int = ...,
update: int = ...,
verbose: int = ...,
dry_run: int = ...,
) -> List[str]: ...
def remove_tree(directory: str, verbose: int = ..., dry_run: int = ...) -> None: ...
+2
View File
@@ -1,3 +1,5 @@
# Stubs for emxccompiler
from distutils.unixccompiler import UnixCCompiler
class EMXCCompiler(UnixCCompiler): ...
-21
View File
@@ -1,21 +0,0 @@
from typing import List, Optional, Tuple
class Extension:
def __init__(
self,
name: str,
sources: List[str],
include_dirs: List[str] = ...,
define_macros: List[Tuple[str, Optional[str]]] = ...,
undef_macros: List[str] = ...,
library_dirs: List[str] = ...,
libraries: List[str] = ...,
runtime_library_dirs: List[str] = ...,
extra_objects: List[str] = ...,
extra_compile_args: List[str] = ...,
extra_link_args: List[str] = ...,
export_symbols: List[str] = ...,
swig_opts: Optional[str] = ..., # undocumented
depends: List[str] = ...,
language: str = ...,
) -> None: ...
-21
View File
@@ -1,21 +0,0 @@
from typing import Any, List, Mapping, Optional, Tuple, Union, overload
_Option = Tuple[str, Optional[str], str]
_GR = Tuple[List[str], OptionDummy]
def fancy_getopt(
options: List[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: Optional[List[str]]
) -> Union[List[str], _GR]: ...
def wrap_text(text: str, width: int) -> List[str]: ...
class FancyGetopt:
def __init__(self, option_table: Optional[List[_Option]] = ...) -> None: ...
# TODO kinda wrong, `getopt(object=object())` is invalid
@overload
def getopt(self, args: Optional[List[str]] = ...) -> _GR: ...
@overload
def getopt(self, args: Optional[List[str]], object: Any) -> List[str]: ...
def get_option_order(self) -> List[Tuple[str, str]]: ...
def generate_help(self, header: Optional[str] = ...) -> List[str]: ...
class OptionDummy: ...
-14
View File
@@ -1,14 +0,0 @@
from typing import Optional, Sequence, Tuple
def copy_file(
src: str,
dst: str,
preserve_mode: bool = ...,
preserve_times: bool = ...,
update: bool = ...,
link: Optional[str] = ...,
verbose: bool = ...,
dry_run: bool = ...,
) -> Tuple[str, str]: ...
def move_file(src: str, dst: str, verbose: bool = ..., dry_run: bool = ...) -> str: ...
def write_file(filename: str, contents: Sequence[str]) -> None: ...
-1
View File
@@ -1 +0,0 @@
class FileList: ...
-3
View File
@@ -1,3 +0,0 @@
from distutils.ccompiler import CCompiler
class MSVCCompiler(CCompiler): ...
-4
View File
@@ -1,4 +0,0 @@
from typing import List, Optional
def spawn(cmd: List[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ...
def find_executable(executable: str, path: Optional[str] = ...) -> Optional[str]: ...
-21
View File
@@ -1,21 +0,0 @@
from typing import IO, List, Optional, Tuple, Union
class TextFile:
def __init__(
self,
filename: Optional[str] = ...,
file: Optional[IO[str]] = ...,
*,
strip_comments: bool = ...,
lstrip_ws: bool = ...,
rstrip_ws: bool = ...,
skip_blanks: bool = ...,
join_lines: bool = ...,
collapse_join: bool = ...,
) -> None: ...
def open(self, filename: str) -> None: ...
def close(self) -> None: ...
def warn(self, msg: str, line: Union[List[int], Tuple[int, int], int] = ...) -> None: ...
def readline(self) -> Optional[str]: ...
def readlines(self) -> List[str]: ...
def unreadline(self, line: str) -> str: ...
-3
View File
@@ -1,3 +0,0 @@
from distutils.ccompiler import CCompiler
class UnixCCompiler(CCompiler): ...
-23
View File
@@ -1,23 +0,0 @@
from typing import Any, Callable, List, Mapping, Optional, Tuple
def get_platform() -> str: ...
def convert_path(pathname: str) -> str: ...
def change_root(new_root: str, pathname: str) -> str: ...
def check_environ() -> None: ...
def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ...
def split_quoted(s: str) -> List[str]: ...
def execute(
func: Callable[..., None], args: Tuple[Any, ...], msg: Optional[str] = ..., verbose: bool = ..., dry_run: bool = ...
) -> None: ...
def strtobool(val: str) -> bool: ...
def byte_compile(
py_files: List[str],
optimize: int = ...,
force: bool = ...,
prefix: Optional[str] = ...,
base_dir: Optional[str] = ...,
verbose: bool = ...,
dry_run: bool = ...,
direct: Optional[bool] = ...,
) -> None: ...
def rfc822_escape(header: str) -> str: ...
-33
View File
@@ -1,33 +0,0 @@
from abc import abstractmethod
from typing import Optional, Pattern, Text, Tuple, TypeVar, Union
_T = TypeVar("_T", bound=Version)
class Version:
def __repr__(self) -> str: ...
@abstractmethod
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
@abstractmethod
def parse(self: _T, vstring: Text) -> _T: ...
@abstractmethod
def __str__(self) -> str: ...
@abstractmethod
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
class StrictVersion(Version):
version_re: Pattern[str]
version: Tuple[int, int, int]
prerelease: Optional[Tuple[Text, int]]
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
def parse(self: _T, vstring: Text) -> _T: ...
def __str__(self) -> str: ...
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
class LooseVersion(Version):
component_re: Pattern[str]
vstring: Text
version: Tuple[Union[Text, int], ...]
def __init__(self, vstring: Optional[Text] = ...) -> None: ...
def parse(self: _T, vstring: Text) -> _T: ...
def __str__(self) -> str: ...
def __cmp__(self: _T, other: Union[_T, str]) -> bool: ...
-3
View File
@@ -1,11 +1,8 @@
def base64_len(s: bytes) -> int: ...
def header_encode(header, charset=..., keep_eols=..., maxlinelen=..., eol=...): ...
def encode(s, binary=..., maxlinelen=..., eol=...): ...
body_encode = encode
encodestring = encode
def decode(s, convert_eols=...): ...
body_decode = decode
decodestring = decode
+1
View File
@@ -11,6 +11,7 @@ class BufferedSubFile:
def __iter__(self): ...
def next(self): ...
class FeedParser:
def __init__(self, _factory=...) -> None: ...
def feed(self, data) -> None: ...
+1
View File
@@ -4,5 +4,6 @@ class Generator:
def flatten(self, msg, unixfrom: bool = ...) -> None: ...
def clone(self, fp): ...
class DecodedGenerator(Generator):
def __init__(self, outfp, mangle_from_: bool = ..., maxheaderlen: int = ..., fmt=...) -> None: ...
+2 -1
View File
@@ -2,7 +2,8 @@ def decode_header(header): ...
def make_header(decoded_seq, maxlinelen=..., header_name=..., continuation_ws=...): ...
class Header:
def __init__(self, s=..., charset=..., maxlinelen=..., header_name=..., continuation_ws=..., errors=...) -> None: ...
def __init__(self, s=..., charset=..., maxlinelen=..., header_name=..., continuation_ws=...,
errors=...) -> None: ...
def __unicode__(self): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
+6 -4
View File
@@ -1,9 +1,11 @@
from email.mime.nonmultipart import MIMENonMultipart
# Stubs for email.mime.application
from typing import Callable, Optional, Tuple, Union
from email.mime.nonmultipart import MIMENonMultipart
_ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
class MIMEApplication(MIMENonMultipart):
def __init__(
self, _data: bytes, _subtype: str = ..., _encoder: Callable[[MIMEApplication], None] = ..., **_params: _ParamsType
) -> None: ...
def __init__(self, _data: bytes, _subtype: str = ...,
_encoder: Callable[[MIMEApplication], None] = ...,
**_params: _ParamsType) -> None: ...
+1
View File
@@ -1,4 +1,5 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEAudio(MIMENonMultipart):
def __init__(self, _audiodata, _subtype=..., _encoder=..., **_params) -> None: ...
+1
View File
@@ -1,4 +1,5 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEImage(MIMENonMultipart):
def __init__(self, _imagedata, _subtype=..., _encoder=..., **_params) -> None: ...
+1
View File
@@ -1,4 +1,5 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEMessage(MIMENonMultipart):
def __init__(self, _msg, _subtype=...) -> None: ...
+5 -7
View File
@@ -1,11 +1,9 @@
from email._parseaddr import (
AddressList as _AddressList,
mktime_tz as mktime_tz,
parsedate as _parsedate,
parsedate_tz as _parsedate_tz,
)
from email._parseaddr import AddressList as _AddressList
from email._parseaddr import mktime_tz as mktime_tz
from email._parseaddr import parsedate as _parsedate
from email._parseaddr import parsedate_tz as _parsedate_tz
from quopri import decodestring as _qdecode
from typing import Any, Optional
from typing import Optional, Any
def formataddr(pair): ...
def getaddresses(fieldvalues): ...
+3 -4
View File
@@ -1,7 +1,6 @@
import codecs
from typing import Any
def search_function(encoding: str) -> codecs.CodecInfo: ...
import typing
# Explicitly mark this package as incomplete.
def __getattr__(name: str) -> Any: ...
def search_function(encoding: str) -> codecs.CodecInfo:
...
+48 -50
View File
@@ -1,50 +1,48 @@
from __builtin__ import (
ArithmeticError as ArithmeticError,
AssertionError as AssertionError,
AttributeError as AttributeError,
BaseException as BaseException,
BufferError as BufferError,
BytesWarning as BytesWarning,
DeprecationWarning as DeprecationWarning,
EnvironmentError as EnvironmentError,
EOFError as EOFError,
Exception as Exception,
FloatingPointError as FloatingPointError,
FutureWarning as FutureWarning,
GeneratorExit as GeneratorExit,
ImportError as ImportError,
ImportWarning as ImportWarning,
IndentationError as IndentationError,
IndexError as IndexError,
IOError as IOError,
KeyboardInterrupt as KeyboardInterrupt,
KeyError as KeyError,
LookupError as LookupError,
MemoryError as MemoryError,
NameError as NameError,
NotImplementedError as NotImplementedError,
OSError as OSError,
OverflowError as OverflowError,
PendingDeprecationWarning as PendingDeprecationWarning,
ReferenceError as ReferenceError,
RuntimeError as RuntimeError,
RuntimeWarning as RuntimeWarning,
StandardError as StandardError,
StopIteration as StopIteration,
SyntaxError as SyntaxError,
SyntaxWarning as SyntaxWarning,
SystemError as SystemError,
SystemExit as SystemExit,
TabError as TabError,
TypeError as TypeError,
UnboundLocalError as UnboundLocalError,
UnicodeDecodeError as UnicodeDecodeError,
UnicodeEncodeError as UnicodeEncodeError,
UnicodeError as UnicodeError,
UnicodeTranslateError as UnicodeTranslateError,
UnicodeWarning as UnicodeWarning,
UserWarning as UserWarning,
ValueError as ValueError,
Warning as Warning,
ZeroDivisionError as ZeroDivisionError,
)
from __builtin__ import ArithmeticError as ArithmeticError
from __builtin__ import AssertionError as AssertionError
from __builtin__ import AttributeError as AttributeError
from __builtin__ import BaseException as BaseException
from __builtin__ import BufferError as BufferError
from __builtin__ import BytesWarning as BytesWarning
from __builtin__ import DeprecationWarning as DeprecationWarning
from __builtin__ import EOFError as EOFError
from __builtin__ import EnvironmentError as EnvironmentError
from __builtin__ import Exception as Exception
from __builtin__ import FloatingPointError as FloatingPointError
from __builtin__ import FutureWarning as FutureWarning
from __builtin__ import GeneratorExit as GeneratorExit
from __builtin__ import IOError as IOError
from __builtin__ import ImportError as ImportError
from __builtin__ import ImportWarning as ImportWarning
from __builtin__ import IndentationError as IndentationError
from __builtin__ import IndexError as IndexError
from __builtin__ import KeyError as KeyError
from __builtin__ import KeyboardInterrupt as KeyboardInterrupt
from __builtin__ import LookupError as LookupError
from __builtin__ import MemoryError as MemoryError
from __builtin__ import NameError as NameError
from __builtin__ import NotImplementedError as NotImplementedError
from __builtin__ import OSError as OSError
from __builtin__ import OverflowError as OverflowError
from __builtin__ import PendingDeprecationWarning as PendingDeprecationWarning
from __builtin__ import ReferenceError as ReferenceError
from __builtin__ import RuntimeError as RuntimeError
from __builtin__ import RuntimeWarning as RuntimeWarning
from __builtin__ import StandardError as StandardError
from __builtin__ import StopIteration as StopIteration
from __builtin__ import SyntaxError as SyntaxError
from __builtin__ import SyntaxWarning as SyntaxWarning
from __builtin__ import SystemError as SystemError
from __builtin__ import SystemExit as SystemExit
from __builtin__ import TabError as TabError
from __builtin__ import TypeError as TypeError
from __builtin__ import UnboundLocalError as UnboundLocalError
from __builtin__ import UnicodeError as UnicodeError
from __builtin__ import UnicodeDecodeError as UnicodeDecodeError
from __builtin__ import UnicodeEncodeError as UnicodeEncodeError
from __builtin__ import UnicodeTranslateError as UnicodeTranslateError
from __builtin__ import UnicodeWarning as UnicodeWarning
from __builtin__ import UserWarning as UserWarning
from __builtin__ import ValueError as ValueError
from __builtin__ import Warning as Warning
from __builtin__ import ZeroDivisionError as ZeroDivisionError
+11 -6
View File
@@ -1,5 +1,5 @@
from _typeshed import FileDescriptorLike
from typing import Any, Union
from typing import Any, Union, IO
import io
FASYNC: int
FD_CLOEXEC: int
@@ -72,11 +72,16 @@ LOCK_SH: int
LOCK_UN: int
LOCK_WRITE: int
_ANYFILE = Union[int, IO]
# TODO All these return either int or bytes depending on the value of
# cmd (not on the type of arg).
def fcntl(fd: FileDescriptorLike, op: int, arg: Union[int, bytes] = ...) -> Any: ...
def fcntl(fd: _ANYFILE, op: int, arg: Union[int, bytes] = ...) -> Any: ...
# TODO: arg: int or read-only buffer interface or read-write buffer interface
def ioctl(fd: FileDescriptorLike, op: int, arg: Union[int, bytes] = ..., mutate_flag: bool = ...) -> Any: ...
def flock(fd: FileDescriptorLike, op: int) -> None: ...
def lockf(fd: FileDescriptorLike, op: int, length: int = ..., start: int = ..., whence: int = ...) -> Any: ...
def ioctl(fd: _ANYFILE, op: int, arg: Union[int, bytes] = ...,
mutate_flag: bool = ...) -> Any: ...
def flock(fd: _ANYFILE, op: int) -> None: ...
def lockf(fd: _ANYFILE, op: int, length: int = ..., start: int = ...,
whence: int = ...) -> Any: ...
+13 -10
View File
@@ -1,25 +1,28 @@
# Stubs for functools (Python 2.7)
# NOTE: These are incomplete!
from abc import ABCMeta, abstractmethod
from typing import Any, Callable, Dict, Generic, Iterable, Optional, Sequence, Tuple, Type, TypeVar, overload
from typing import Any, Callable, Generic, Dict, Iterable, Optional, Sequence, Tuple, TypeVar, overload
_AnyCallable = Callable[..., Any]
_T = TypeVar("_T")
_S = TypeVar("_S")
@overload
def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ...
def reduce(function: Callable[[_T, _T], _T],
sequence: Iterable[_T]) -> _T: ...
@overload
def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ...
def reduce(function: Callable[[_T, _S], _T],
sequence: Iterable[_S], initial: _T) -> _T: ...
WRAPPER_ASSIGNMENTS: Sequence[str]
WRAPPER_UPDATES: Sequence[str]
def update_wrapper(
wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...
) -> _AnyCallable: ...
def wraps(
wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...
) -> Callable[[_AnyCallable], _AnyCallable]: ...
def total_ordering(cls: Type[_T]) -> Type[_T]: ...
def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ...,
updated: Sequence[str] = ...) -> _AnyCallable: ...
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...
def total_ordering(cls: type) -> type: ...
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
class partial(Generic[_T]):
+8 -4
View File
@@ -1,10 +1,14 @@
from itertools import ifilter, imap, izip
from typing import Any
filter = ifilter
map = imap
zip = izip
from itertools import ifilter as filter
from itertools import imap as map
from itertools import izip as zip
def ascii(obj: Any) -> str: ...
def hex(x: int) -> str: ...
def oct(x: int) -> str: ...
+5 -1
View File
@@ -1,5 +1,8 @@
# Stubs for gc
from typing import Any, List, Tuple
def enable() -> None: ...
def disable() -> None: ...
def isenabled() -> bool: ...
@@ -7,7 +10,8 @@ def collect(generation: int = ...) -> int: ...
def set_debug(flags: int) -> None: ...
def get_debug() -> int: ...
def get_objects() -> List[Any]: ...
def set_threshold(threshold0: int, threshold1: int = ..., threshold2: int = ...) -> None: ...
def set_threshold(threshold0: int, threshold1: int = ...,
threshold2: int = ...) -> None: ...
def get_count() -> Tuple[int, int, int]: ...
def get_threshold() -> Tuple[int, int, int]: ...
def get_referrers(*objs: Any) -> List[Any]: ...
+3 -1
View File
@@ -1,4 +1,6 @@
from typing import IO, Any
# Stubs for getpass (Python 2)
from typing import Any, IO
class GetPassWarning(UserWarning): ...
+8 -15
View File
@@ -1,4 +1,4 @@
from typing import IO, Any, Container, Dict, List, Optional, Sequence, Type, Union
from typing import Any, Container, Dict, IO, List, Optional, Sequence, Type, Union
def bindtextdomain(domain: str, localedir: str = ...) -> str: ...
def bind_textdomain_codeset(domain: str, codeset: str = ...) -> str: ...
@@ -32,17 +32,10 @@ class GNUTranslations(NullTranslations):
LE_MAGIC: int
BE_MAGIC: int
def find(
domain: str, localedir: Optional[str] = ..., languages: Optional[Sequence[str]] = ..., all: Any = ...
) -> Optional[Union[str, List[str]]]: ...
def translation(
domain: str,
localedir: Optional[str] = ...,
languages: Optional[Sequence[str]] = ...,
class_: Optional[Type[NullTranslations]] = ...,
fallback: bool = ...,
codeset: Optional[str] = ...,
) -> NullTranslations: ...
def install(
domain: str, localedir: Optional[str] = ..., unicode: bool = ..., codeset: Optional[str] = ..., names: Container[str] = ...
) -> None: ...
def find(domain: str, localedir: Optional[str] = ..., languages: Optional[Sequence[str]] = ...,
all: Any = ...) -> Optional[Union[str, List[str]]]: ...
def translation(domain: str, localedir: Optional[str] = ..., languages: Optional[Sequence[str]] = ...,
class_: Optional[Type[NullTranslations]] = ..., fallback: bool = ..., codeset: Optional[str] = ...) -> NullTranslations: ...
def install(domain: str, localedir: Optional[str] = ..., unicode: bool = ..., codeset: Optional[str] = ...,
names: Container[str] = ...) -> None: ...
+1 -1
View File
@@ -1,4 +1,4 @@
from typing import AnyStr, Iterator, List, Union
from typing import List, Iterator, Union, AnyStr
def glob(pathname: AnyStr) -> List[AnyStr]: ...
def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ...
+3 -4
View File
@@ -1,5 +1,5 @@
from typing import Any, IO, Text
import io
from typing import IO, Any, Text
class GzipFile(io.BufferedIOBase):
myfileobj: Any
@@ -14,9 +14,8 @@ class GzipFile(io.BufferedIOBase):
fileobj: Any
offset: Any
mtime: Any
def __init__(
self, filename: str = ..., mode: Text = ..., compresslevel: int = ..., fileobj: IO[str] = ..., mtime: float = ...
) -> None: ...
def __init__(self, filename: str = ..., mode: Text = ..., compresslevel: int = ...,
fileobj: IO[str] = ..., mtime: float = ...) -> None: ...
@property
def filename(self): ...
size: Any
+3
View File
@@ -1,3 +1,5 @@
# Stubs for hashlib (Python 2)
from typing import Tuple, Union
_DataType = Union[str, unicode, bytearray, buffer, memoryview]
@@ -14,6 +16,7 @@ class _hash(object): # This is not actually in the module namespace.
def copy(self) -> _hash: ...
def new(name: str, data: str = ...) -> _hash: ...
def md5(s: _DataType = ...) -> _hash: ...
def sha1(s: _DataType = ...) -> _hash: ...
def sha224(s: _DataType = ...) -> _hash: ...
+9 -6
View File
@@ -1,7 +1,9 @@
from _typeshed import SupportsLessThan
from typing import Any, Callable, Iterable, List, Optional, Protocol, TypeVar
from typing import TypeVar, List, Iterable, Any, Callable, Optional, Protocol
_T = TypeVar("_T")
_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: ...
@@ -10,6 +12,7 @@ def heappushpop(heap: List[_T], item: _T) -> _T: ...
def heapify(x: List[_T]) -> None: ...
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], SupportsLessThan]] = ...) -> List[_T]: ...
def nsmallest(n: int, iterable: Iterable[_T], key: Optional[Callable[[_T], SupportsLessThan]] = ...) -> List[_T]: ...
def _heapify_max(__x: List[_T]) -> None: ... # undocumented
def nlargest(n: int, iterable: Iterable[_T],
key: Optional[Callable[[_T], _Sortable]] = ...) -> List[_T]: ...
def nsmallest(n: int, iterable: Iterable[_T],
key: Optional[Callable[[_T], _Sortable]] = ...) -> List[_T]: ...
+14 -27
View File
@@ -1,6 +1,11 @@
# Stubs for httplib (Python 2)
#
# Generated by stubgen and manually massaged a bit.
# Needs lots more work!
from typing import Any, Dict, Optional, Protocol
import mimetools
import ssl
from typing import Any, Dict, Optional, Protocol
class HTTPMessage(mimetools.Message):
def addcontinue(self, key: str, more: str) -> None: ...
@@ -24,9 +29,8 @@ class HTTPResponse:
chunk_left: Any
length: Any
will_close: Any
def __init__(
self, sock, debuglevel: int = ..., strict: int = ..., method: Optional[Any] = ..., buffering: bool = ...
) -> None: ...
def __init__(self, sock, debuglevel: int = ..., strict: int = ..., method: Optional[Any] = ...,
buffering: bool = ...) -> None: ...
def begin(self): ...
def close(self): ...
def isclosed(self): ...
@@ -55,9 +59,8 @@ class HTTPConnection:
sock: Any
host: str = ...
port: int = ...
def __init__(
self, host, port: Optional[Any] = ..., strict: Optional[Any] = ..., timeout=..., source_address: Optional[Any] = ...
) -> None: ...
def __init__(self, host, port: Optional[Any] = ..., strict: Optional[Any] = ..., timeout=...,
source_address: Optional[Any] = ...) -> None: ...
def set_tunnel(self, host, port: Optional[Any] = ..., headers: Optional[Any] = ...): ...
def set_debuglevel(self, level): ...
def connect(self): ...
@@ -83,32 +86,16 @@ class HTTPSConnection(HTTPConnection):
default_port: Any
key_file: Any
cert_file: Any
def __init__(
self,
host,
port: Optional[Any] = ...,
key_file: Optional[Any] = ...,
cert_file: Optional[Any] = ...,
strict: Optional[Any] = ...,
timeout=...,
source_address: Optional[Any] = ...,
context: Optional[Any] = ...,
) -> None: ...
def __init__(self, host, port: Optional[Any] = ..., key_file: Optional[Any] = ..., cert_file: Optional[Any] = ...,
strict: Optional[Any] = ..., timeout=..., source_address: Optional[Any] = ...,
context: Optional[Any] = ...) -> None: ...
sock: Any
def connect(self): ...
class HTTPS(HTTP):
key_file: Any
cert_file: Any
def __init__(
self,
host: str = ...,
port: Optional[Any] = ...,
key_file: Optional[Any] = ...,
cert_file: Optional[Any] = ...,
strict: Optional[Any] = ...,
context: Optional[Any] = ...,
) -> None: ...
def __init__(self, host: str = ..., port: Optional[Any] = ..., key_file: Optional[Any] = ..., cert_file: Optional[Any] = ..., strict: Optional[Any] = ..., context: Optional[Any] = ...) -> None: ...
class HTTPException(Exception): ...
class NotConnected(HTTPException): ...
+3 -1
View File
@@ -1,5 +1,7 @@
"""Stubs for the 'imp' module."""
from typing import List, Optional, Tuple, Iterable, IO, Any
import types
from typing import IO, Any, Iterable, List, Optional, Tuple
C_BUILTIN: int
C_EXTENSION: int
+22 -22
View File
@@ -1,5 +1,5 @@
from types import CodeType, FrameType, FunctionType, MethodType, ModuleType, TracebackType
from typing import Any, AnyStr, Callable, Dict, List, NamedTuple, Optional, Sequence, Tuple, Type, Union
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
class EndOfBlock(Exception): ...
@@ -10,9 +10,8 @@ class BlockFinder:
started: bool
passline: bool
last: int
def tokeneater(
self, type: int, token: AnyStr, srow_scol: Tuple[int, int], erow_ecol: Tuple[int, int], line: AnyStr
) -> None: ...
def tokeneater(self, type: int, token: str, srow_scol: Tuple[int, int],
erow_ecol: Tuple[int, int], line: str) -> None: ...
CO_GENERATOR: int
CO_NESTED: int
@@ -29,9 +28,13 @@ class ModuleInfo(NamedTuple):
mode: str
module_type: int
def getmembers(object: object, predicate: Optional[Callable[[Any], bool]] = ...) -> List[Tuple[str, Any]]: ...
def getmoduleinfo(path: Union[str, unicode]) -> Optional[ModuleInfo]: ...
def getmodulename(path: AnyStr) -> Optional[AnyStr]: ...
def getmembers(
object: object,
predicate: Optional[Callable[[Any], bool]] = ...
) -> List[Tuple[str, Any]]: ...
def getmoduleinfo(path: str) -> Optional[ModuleInfo]: ...
def getmodulename(path: str) -> Optional[str]: ...
def ismodule(object: object) -> bool: ...
def isclass(object: object) -> bool: ...
def ismethod(object: object) -> bool: ...
@@ -54,7 +57,7 @@ _SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, Trace
def findsource(object: _SourceObjectType) -> Tuple[List[str], int]: ...
def getabsfile(object: _SourceObjectType) -> str: ...
def getblock(lines: Sequence[AnyStr]) -> Sequence[AnyStr]: ...
def getblock(lines: Sequence[str]) -> Sequence[str]: ...
def getdoc(object: object) -> Optional[str]: ...
def getcomments(object: object) -> Optional[str]: ...
def getfile(object: _SourceObjectType) -> str: ...
@@ -62,8 +65,8 @@ 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: AnyStr) -> AnyStr: ...
def indentsize(line: Union[str, unicode]) -> int: ...
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[Any]]]: ...
@@ -88,12 +91,12 @@ class Arguments(NamedTuple):
def getargs(co: CodeType) -> Arguments: ...
def getargspec(func: object) -> ArgSpec: ...
def getargvalues(frame: FrameType) -> ArgInfo: ...
def formatargspec(
args, varargs=..., varkw=..., defaults=..., formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=..., join=...
) -> str: ...
def formatargvalues(
args, varargs=..., varkw=..., defaults=..., formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=..., join=...
) -> str: ...
def formatargspec(args, varargs=..., varkw=..., defaults=...,
formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=...,
join=...) -> str: ...
def formatargvalues(args, varargs=..., varkw=..., defaults=...,
formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=...,
join=...) -> str: ...
def getmro(cls: type) -> Tuple[type, ...]: ...
def getcallargs(func, *args, **kwds) -> Dict[str, Any]: ...
@@ -112,18 +115,15 @@ def getouterframes(frame: FrameType, context: int = ...) -> List[_FrameInfo]: ..
def getframeinfo(frame: Union[FrameType, TracebackType], context: int = ...) -> Traceback: ...
def getinnerframes(traceback: TracebackType, context: int = ...) -> List[_FrameInfo]: ...
def getlineno(frame: FrameType) -> int: ...
def currentframe(depth: int = ...) -> FrameType: ...
def stack(context: int = ...) -> List[_FrameInfo]: ...
def trace(context: int = ...) -> List[_FrameInfo]: ...
# Create private type alias to avoid conflict with symbol of same
# name created in Attribute class.
_Object = object
class Attribute(NamedTuple):
name: str
kind: str
defining_class: type
object: _Object
object: object
def classify_class_attrs(cls: type) -> List[Attribute]: ...
+27 -25
View File
@@ -1,38 +1,40 @@
from typing import IO, Any, Union
# Stubs for io
# Based on https://docs.python.org/2/library/io.html
# Only a subset of functionality is included.
from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Any, Union, Optional
import _io
from _io import (
DEFAULT_BUFFER_SIZE as DEFAULT_BUFFER_SIZE,
BlockingIOError as BlockingIOError,
BufferedRandom as BufferedRandom,
BufferedReader as BufferedReader,
BufferedRWPair as BufferedRWPair,
BufferedWriter as BufferedWriter,
BytesIO as BytesIO,
FileIO as FileIO,
IncrementalNewlineDecoder as IncrementalNewlineDecoder,
StringIO as StringIO,
TextIOWrapper as TextIOWrapper,
UnsupportedOperation as UnsupportedOperation,
open as open,
)
def _OpenWrapper(
file: Union[str, unicode, int],
mode: unicode = ...,
buffering: int = ...,
encoding: unicode = ...,
errors: unicode = ...,
newline: unicode = ...,
closefd: bool = ...,
) -> IO[Any]: ...
from _io import BlockingIOError as BlockingIOError
from _io import BufferedRWPair as BufferedRWPair
from _io import BufferedRandom as BufferedRandom
from _io import BufferedReader as BufferedReader
from _io import BufferedWriter as BufferedWriter
from _io import BytesIO as BytesIO
from _io import DEFAULT_BUFFER_SIZE as DEFAULT_BUFFER_SIZE
from _io import FileIO as FileIO
from _io import IncrementalNewlineDecoder as IncrementalNewlineDecoder
from _io import StringIO as StringIO
from _io import TextIOWrapper as TextIOWrapper
from _io import UnsupportedOperation as UnsupportedOperation
from _io import open as open
def _OpenWrapper(file: Union[str, unicode, int],
mode: unicode = ..., buffering: int = ..., encoding: unicode = ...,
errors: unicode = ..., newline: unicode = ...,
closefd: bool = ...) -> IO[Any]: ...
SEEK_SET: int
SEEK_CUR: int
SEEK_END: int
class IOBase(_io._IOBase): ...
class RawIOBase(_io._RawIOBase, IOBase): ...
class BufferedIOBase(_io._BufferedIOBase, IOBase): ...
# Note: In the actual io.py, TextIOBase subclasses IOBase.
+113 -114
View File
@@ -1,14 +1,16 @@
from typing import Any, Callable, Generic, Iterable, Iterator, Optional, Sequence, Tuple, TypeVar, Union, overload
# Stubs for itertools
_T = TypeVar("_T")
_S = TypeVar("_S")
# Based on https://docs.python.org/2/library/itertools.html
def count(start: int = ..., step: int = ...) -> Iterator[int]: ... # more general types?
from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple,
Union, Sequence, Generic, Optional)
class cycle(Iterator[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T]) -> None: ...
def next(self) -> _T: ...
def __iter__(self) -> Iterator[_T]: ...
_T = TypeVar('_T')
_S = TypeVar('_S')
def count(start: int = ...,
step: int = ...) -> Iterator[int]: ... # more general types?
def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ...
def repeat(object: _T, times: int = ...) -> Iterator[_T]: ...
@@ -20,145 +22,142 @@ class chain(Iterator[_T], Generic[_T]):
def from_iterable(iterable: Iterable[Iterable[_S]]) -> Iterator[_S]: ...
def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ...
def dropwhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ...
def ifilter(predicate: Optional[Callable[[_T], Any]], iterable: Iterable[_T]) -> Iterator[_T]: ...
def ifilterfalse(predicate: Optional[Callable[[_T], Any]], iterable: Iterable[_T]) -> Iterator[_T]: ...
def dropwhile(predicate: Callable[[_T], Any],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def ifilter(predicate: Optional[Callable[[_T], Any]],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def ifilterfalse(predicate: Optional[Callable[[_T], Any]],
iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def groupby(iterable: Iterable[_T], key: None = ...) -> Iterator[Tuple[_T, Iterator[_T]]]: ...
@overload
def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ...
@overload
def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ...
@overload
def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> Iterator[_T]: ...
def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int],
step: Optional[int] = ...) -> Iterator[_T]: ...
_T1 = TypeVar('_T1')
_T2 = TypeVar('_T2')
_T3 = TypeVar('_T3')
_T4 = TypeVar('_T4')
_T5 = TypeVar('_T5')
_T6 = TypeVar('_T6')
_T1 = TypeVar("_T1")
_T2 = TypeVar("_T2")
_T3 = TypeVar("_T3")
_T4 = TypeVar("_T4")
_T5 = TypeVar("_T5")
_T6 = TypeVar("_T6")
@overload
def imap(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ...
@overload
def imap(func: Callable[[_T1, _T2], _S], iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[_S]: ...
def imap(func: Callable[[_T1, _T2], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterator[_S]: ...
@overload
def imap(
func: Callable[[_T1, _T2, _T3], _S], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]
) -> Iterator[_S]: ...
def imap(func: Callable[[_T1, _T2, _T3], _S],
iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> Iterator[_S]: ...
@overload
def imap(
func: Callable[[_T1, _T2, _T3, _T4], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
) -> Iterator[_S]: ...
def imap(func: Callable[[_T1, _T2, _T3, _T4], _S],
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> Iterator[_S]: ...
@overload
def imap(
func: Callable[[_T1, _T2, _T3, _T4, _T5], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5],
) -> Iterator[_S]: ...
def imap(func: Callable[[_T1, _T2, _T3, _T4, _T5], _S],
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> Iterator[_S]: ...
@overload
def imap(
func: Callable[[_T1, _T2, _T3, _T4, _T5, _T6], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5],
iter6: Iterable[_T6],
) -> Iterator[_S]: ...
def imap(func: Callable[[_T1, _T2, _T3, _T4, _T5, _T6], _S],
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4], iter5: Iterable[_T5],
iter6: Iterable[_T6]) -> Iterator[_S]: ...
@overload
def imap(
func: Callable[..., _S],
iter1: Iterable[Any],
iter2: Iterable[Any],
iter3: Iterable[Any],
iter4: Iterable[Any],
iter5: Iterable[Any],
iter6: Iterable[Any],
iter7: Iterable[Any],
*iterables: Iterable[Any],
) -> Iterator[_S]: ...
def imap(func: Callable[..., _S],
iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any],
iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any],
iter7: Iterable[Any], *iterables: Iterable[Any]) -> Iterator[_S]: ...
def starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: ...
def takewhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ...
def takewhile(predicate: Callable[[_T], Any],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def tee(iterable: Iterable[_T], n: int = ...) -> Tuple[Iterator[_T], ...]: ...
@overload
def izip(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
@overload
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
def izip(iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
@overload
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
@overload
def izip(
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4]
) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ...
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2,
_T3, _T4]]: ...
@overload
def izip(
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5]
) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3], iter4: Iterable[_T4],
iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2,
_T3, _T4, _T5]]: ...
@overload
def izip(
iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5],
iter6: Iterable[_T6],
) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3], iter4: Iterable[_T4],
iter5: Iterable[_T5], iter6: Iterable[_T6]) -> Iterator[Tuple[_T1, _T2, _T3,
_T4, _T5, _T6]]: ...
@overload
def izip(
iter1: Iterable[Any],
iter2: Iterable[Any],
iter3: Iterable[Any],
iter4: Iterable[Any],
iter5: Iterable[Any],
iter6: Iterable[Any],
iter7: Iterable[Any],
*iterables: Iterable[Any],
) -> Iterator[Tuple[Any, ...]]: ...
def izip_longest(*p: Iterable[Any], fillvalue: Any = ...) -> Iterator[Any]: ...
def izip(iter1: Iterable[Any], iter2: Iterable[Any],
iter3: Iterable[Any], iter4: Iterable[Any],
iter5: Iterable[Any], iter6: Iterable[Any],
iter7: Iterable[Any], *iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ...
def izip_longest(*p: Iterable[Any],
fillvalue: Any = ...) -> Iterator[Any]: ...
@overload
def product(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
@overload
def product(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
def product(iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
@overload
def product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
def product(iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
@overload
def product(
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4]
) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ...
def product(iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ...
@overload
def product(
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5]
) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
def product(iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
@overload
def product(
iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5],
iter6: Iterable[_T6],
) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...
def product(iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5],
iter6: Iterable[_T6]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...
@overload
def product(
iter1: Iterable[Any],
iter2: Iterable[Any],
iter3: Iterable[Any],
iter4: Iterable[Any],
iter5: Iterable[Any],
iter6: Iterable[Any],
iter7: Iterable[Any],
*iterables: Iterable[Any],
) -> Iterator[Tuple[Any, ...]]: ...
def product(iter1: Iterable[Any],
iter2: Iterable[Any],
iter3: Iterable[Any],
iter4: Iterable[Any],
iter5: Iterable[Any],
iter6: Iterable[Any],
iter7: Iterable[Any],
*iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ...
@overload
def product(*iterables: Iterable[Any], repeat: int) -> Iterator[Tuple[Any, ...]]: ...
def permutations(iterable: Iterable[_T], r: int = ...) -> Iterator[Sequence[_T]]: ...
def combinations(iterable: Iterable[_T], r: int) -> Iterator[Sequence[_T]]: ...
def combinations_with_replacement(iterable: Iterable[_T], r: int) -> Iterator[Sequence[_T]]: ...
def permutations(iterable: Iterable[_T],
r: int = ...) -> Iterator[Sequence[_T]]: ...
def combinations(iterable: Iterable[_T],
r: int) -> Iterator[Sequence[_T]]: ...
def combinations_with_replacement(iterable: Iterable[_T],
r: int) -> Iterator[Sequence[_T]]: ...

Some files were not shown because too many files have changed in this diff Show More