diff --git a/python/helpers/typeshed/.github/workflows/mypy_primer.yml b/python/helpers/typeshed/.github/workflows/mypy_primer.yml index 8fb950948ff8..c7e96261a59a 100644 --- a/python/helpers/typeshed/.github/workflows/mypy_primer.yml +++ b/python/helpers/typeshed/.github/workflows/mypy_primer.yml @@ -38,7 +38,7 @@ jobs: # fail action if exit code isn't zero or one ( mypy_primer \ - --new 0.790 --old 0.790 \ + --new 4d5a1bc752 --old 4d5a1bc752 \ --custom-typeshed-repo typeshed_to_test \ --new-typeshed $GITHUB_SHA --old-typeshed upstream_master \ --num-shards 2 --shard-index ${{ matrix.shard-index }} \ diff --git a/python/helpers/typeshed/.github/workflows/mypy_primer_comment.yml b/python/helpers/typeshed/.github/workflows/mypy_primer_comment.yml index 15d259d91f25..965607aed86b 100644 --- a/python/helpers/typeshed/.github/workflows/mypy_primer_comment.yml +++ b/python/helpers/typeshed/.github/workflows/mypy_primer_comment.yml @@ -89,15 +89,11 @@ jobs: 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) + 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 + '```' + }) } diff --git a/python/helpers/typeshed/.github/workflows/tests.yml b/python/helpers/typeshed/.github/workflows/tests.yml index 8ce9b4c0a509..ff94b54ab646 100644 --- a/python/helpers/typeshed/.github/workflows/tests.yml +++ b/python/helpers/typeshed/.github/workflows/tests.yml @@ -11,7 +11,9 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - run: ./tests/check_consistent.py + - run: | + pip install toml + ./tests/check_consistent.py flake8: name: Lint with flake8 @@ -31,7 +33,7 @@ jobs: - uses: actions/setup-python@v2 - run: | pip install $(grep black requirements-tests-py3.txt) - black --check --diff stdlib third_party + black --check --diff stdlib stubs isort: name: Check imports with isort @@ -41,7 +43,7 @@ jobs: - uses: actions/setup-python@v2 - run: | pip install $(grep isort requirements-tests-py3.txt) - isort --check-only --diff stdlib third_party + isort --check-only --diff stdlib stubs pytype: name: Run pytype against the stubs @@ -83,8 +85,24 @@ jobs: - uses: actions/setup-python@v2 - run: ./tests/mypy_test_suite.py + pyright: + name: Run pyright against the stubs + runs-on: ubuntu-latest + strategy: + matrix: + python-platform: ["Linux", "Windows", "Darwin"] + python-version: [3.6, 3.7, 3.8, 3.9] + fail-fast: false + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - run: ./tests/pyright_test.py --pythonplatform ${{ matrix.python-platform }} --pythonversion ${{ matrix.python-version }} + stubtest: - name: Check stubs with stubtest + name: Check stdlib with stubtest runs-on: ${{ matrix.os }} strategy: matrix: @@ -101,6 +119,6 @@ jobs: - name: Install dependencies run: | python -m pip install -U pip - pip install -U git+git://github.com/python/mypy@24fdf343 + pip install -U git+git://github.com/python/mypy@master - name: Run stubtest run: python tests/stubtest_test.py --ignore-unused-whitelist diff --git a/python/helpers/typeshed/CONTRIBUTING.md b/python/helpers/typeshed/CONTRIBUTING.md index cac4f87335b4..900c45c456f8 100644 --- a/python/helpers/typeshed/CONTRIBUTING.md +++ b/python/helpers/typeshed/CONTRIBUTING.md @@ -209,9 +209,6 @@ you should know about. Style conventions for stub files are different from PEP 8. The general rule is that they should be as concise as possible. Specifically: -* lines can be up to 130 characters long; -* functions and methods that don't fit in one line should be split up - with one argument per line; * all function bodies should be empty; * prefer ``...`` over ``pass``; * prefer ``...`` on the same line as the class/function signature; @@ -221,8 +218,7 @@ rule is that they should be as concise as possible. Specifically: if the classes are very small; * do not use docstrings; * 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 `=`. + that target older versions of Python. Stubs should be reformatted with the formatters [black](https://github.com/psf/black) and @@ -241,7 +237,13 @@ checker, and leave out unnecessary detail: * use `float` instead of `Union[int, float]`. Some further tips for good type hints: -* avoid invariant collection types (`List`, `Dict`) in argument +* use built-in generics (`list`, `dict`, `tuple`, `set`), instead + of importing them from `typing`, **except** for arbitrary length tuples + (`Tuple[int, ...]`) (see + [python/mypy#9980](https://github.com/python/mypy/issues/9980)); +* in Python 3 stubs, import collections (`Mapping`, `Iterable`, etc.) + from `collections.abc` instead of `typing`; +* avoid invariant collection types (`list`, `dict`) in argument positions, in favor of covariant types like `Mapping` or `Sequence`; * avoid Union return types: https://github.com/python/mypy/issues/1693; * in Python 2, whenever possible, use `unicode` if that's the only @@ -265,14 +267,6 @@ Note that `Any` is not the correct type to use if you want to indicate that some function can accept literally anything: in those cases use `object` instead. -For arguments with type and a default value of `None`, PEP 484 -prescribes that the type automatically becomes `Optional`. However we -prefer explicit over implicit in this case, and require the explicit -`Optional[]` around the type. The mypy tests enforce this (through -the use of --no-implicit-optional) and the error looks like -`Incompatible types in assignment (expression has type None, variable -has type "Blah") `. - Stub files support forward references natively. In other words, the order of class declarations and type aliases does not matter in a stub file. You can also use the name of the class within its own @@ -308,30 +302,19 @@ contributors. ### Stub versioning -There are separate directories for `stdlib` and `third_party` stubs. -Within those, there are separate directories for different versions of -Python the stubs target. +There are separate directories for `stdlib` (standard library) and `stubs` +(all other stubs). For standard library stubs Python version support is +given in `VERSIONS` file. Each line in this file is a module or package name +followed by `: `, followed by the oldest *supported* Python version where +the module is available. For third party packages, the Python version support +(2 and/or 3 only, no finer grained version is supported) is indicated in the +corresponding `METADATA.toml` file as `python2 = (True|False)` (defaults to +`False`) and `python3 = (True|False)` (defaults to `True`). -The directory name indicates the major version of Python that a stub targets -and optionally the lowest minor version, with the exception of the `2and3` -directory which applies to both Python 2 and 3. - -For example, stubs in the `3` directory will be applied to all versions of -Python 3, though stubs in the `3.7` directory will only be applied to versions -3.7 and above. However, stubs in the `2` directory will not be applied to -Python 3. - -It is preferred to use a single stub in the more generic directory that -conditionally targets specific versions when needed, as opposed -to maintaining multiple stub files within more specific directories. Similarly, -if the given library works on both Python 2 and Python 3, prefer to put your -stubs in the `2and3` directory, unless the types are so different that the stubs -become unreadable that way. - -You can use checks like `if sys.version_info >= (3, 8):` to denote new -functionality introduced in a given Python version or solve type -differences. When doing so, only use one-tuples or two-tuples. This is -because: +It is preferred to use a single stub for every module. You can use checks +like `if sys.version_info >= (3, 8):` to denote new functionality introduced +in a given Python version or solve type differences. When doing so, only use +one-tuples or two-tuples. This is because: * mypy doesn't support more fine-grained version checks; and more importantly @@ -353,10 +336,28 @@ harmless. This is a strictly better compromise than using the latter two forms, which would generate false positive errors for correct use under Python 3.7.4. +If it is not possible to generate combined stubs for all Python versions +in a single file, you can split Python 2 and Python 3 stubs and place Python 2 +stubs into `@python2` subdirectory for corresponding distribution. Note that +you don't need `@python2` in most cases, if your package supports Python 2, +just put the stubs at root of the distribution directory, and put +`python2 = True` in `METADATA.toml`. + Note: in its current implementation, typeshed cannot contain stubs for multiple versions of the same third-party library. Prefer to generate stubs for the latest version released on PyPI at the time of your -stubbing. +stubbing. The oldest version of the library for which the stubs are still +applicable (i.e. reflect the actual runtime behaviour) can be indicated +in `METADATA.toml` as `version = "x.y"`. Note that only two most significant +version levels are supported (i.e. only single dot). When a significant change +is made in the library, the version of the stub should be bumped (note that +previous versions are still available on PyPI). + +Internal typeshed machinery will periodically build and upload modified +third party packages to PyPI, each time this happens the least significant +version level is incremented. For example, if `stubs/foo/METADATA.toml` has +`version = "x.y"` the package on PyPI will be updated from `types-foo-x.y.n` +to `types-foo-x.y.n+1`. ### What to do when a project's documentation and implementation disagree diff --git a/python/helpers/typeshed/README.md b/python/helpers/typeshed/README.md index 49e2aad566b3..e8884fa74f0f 100644 --- a/python/helpers/typeshed/README.md +++ b/python/helpers/typeshed/README.md @@ -23,27 +23,20 @@ Typeshed supports Python versions 2.7 and 3.6 and up. If you're just using mypy (or pytype or PyCharm), as opposed to developing it, you don't need to interact with the typeshed repo at -all: a copy of typeshed is bundled with mypy. +all: a copy of standard library part of typeshed is bundled with mypy. +And type stubs for third party packages and modules you are using can +be installed from PyPI. For example, if you are using `six` and `requests`, +you can install the type stubs using -When you use a checked-out clone of the mypy repo, a copy of typeshed -should be included as a submodule, using + $ pip install types-six types-requests - $ git clone --recurse-submodules https://github.com/python/mypy.git +These PyPI packages follow [PEP 561](http://www.python.org/dev/peps/pep-0561/) +and are automatically generated by typeshed internal machinery. Also starting +from version 0.900 mypy will provide an option to automatically install missing +type stub packages (if found on PyPI). -or - - $ git clone https://github.com/python/mypy.git - $ cd mypy - $ git submodule init - $ git submodule update - -and occasionally you will have to repeat the final command (`git -submodule update`) to pull in changes made in the upstream typeshed -repo. - -PyCharm and pytype similarly include a copy of typeshed. The one in -pytype can be updated in the same way if you are working with the -pytype repo. +PyCharm, pytype etc. work in a similar way, for more details see documentation +for the type-checking tool you are using. ## Format @@ -63,16 +56,31 @@ coding style used in typeshed. ### stdlib -This contains stubs for modules the Python standard library -- which +This contains stubs for modules in the Python standard library -- which includes pure Python modules, dynamically loaded extension modules, -hard-linked extension modules, and the builtins. +hard-linked extension modules, and the builtins. `VERSIONS` file lists +the oldest *supported* Python version where the module is available. +In the `stdlib/@python2` subdirectory you can find Python 2 versions of +the stub files that must be kept different for Python 2 and 3, like +`builtins.pyi`. -### third_party +### stubs Modules that are not shipped with Python but have a type description in Python -go into `third_party`. Since these modules can behave differently for different -versions of Python, `third_party` has version subdirectories, just like -`stdlib`. +go into `stubs`. Each subdirectory there represents a PyPI distribution, and +contains the following: +* `METADATA.toml` that specifies oldest version of the source library for + which the stubs are applicable, supported Python versions (Python 3 defaults + to `True`, Python 2 defaults to `False`), and dependency on other type stub + packages. +* Stubs (i.e. `*.pyi` files) for packages and modules that are shipped in the + source distribution. Similar to standard library, if the Python 2 version of + the stubs must be kept *separate*, it can be put in a `@python` subdirectory. +* (Rarely) some docs specific to a given type stub package in `README` file. + +No other files are allowed in `stdlib` and `stubs`. When a third party stub is +modified, an updated version of the corresponding distribution will be +automatically uploaded to PyPI shortly (within few hours). For more information on directory structure and stub versioning, see [the relevant section of CONTRIBUTING.md]( @@ -87,8 +95,8 @@ following criteria is met: ## Contributing -Please read [CONTRIBUTING.md](CONTRIBUTING.md) before submitting pull -requests. If you have questions related to contributing, drop by the [typing Gitter](https://gitter.im/python/typing). +Please read [CONTRIBUTING.md](CONTRIBUTING.md) before submitting pull requests. +If you have questions related to contributing, drop by the [typing Gitter](https://gitter.im/python/typing). ## Running the tests @@ -100,6 +108,8 @@ There are several tests: tests typeshed with [mypy](https://github.com/python/mypy/) - `tests/pytype_test.py` tests typeshed with [pytype](https://github.com/google/pytype/). +- `tests/pyright_test.py` tests typeshed with +[pyright](https://github.com/microsoft/pyright). - `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 @@ -113,7 +123,7 @@ consistent with each other. Run: ``` -$ python3.6 -m venv .venv3 +$ python3 -m venv .venv3 $ source .venv3/bin/activate (.venv3)$ pip install -U pip (.venv3)$ pip install -r requirements-tests-py3.txt @@ -121,6 +131,9 @@ $ source .venv3/bin/activate This will install mypy (you need the latest master branch from GitHub), typed-ast, flake8 (and plugins), pytype, black and isort. +If you want to run the pyright tests, you need to have +[Node.js](https://nodejs.org/) installed. + ### mypy_test.py This test requires Python 3.6 or higher; Python 3.6.1 or higher is recommended. @@ -152,6 +165,10 @@ Run using: `(.venv3)$ python3 tests/pytype_test.py` This test works similarly to `mypy_test.py`, except it uses `pytype`. +### pyright\_test.py + +This test requires Node.js to be installed. + ### mypy_self_check.py This test requires Python 3.6 or higher; Python 3.6.1 or higher is recommended. diff --git a/python/helpers/typeshed/pyrightconfig.json b/python/helpers/typeshed/pyrightconfig.json new file mode 100644 index 000000000000..bbb3168a8193 --- /dev/null +++ b/python/helpers/typeshed/pyrightconfig.json @@ -0,0 +1,83 @@ +{ + "typeshedPath": ".", + "include": [ + "stdlib", + "stubs" + ], + "exclude": [ + "**/@python2", + "stdlib/encodings/__init__.pyi", + "stdlib/sqlite3/dbapi2.pyi", + "stdlib/tkinter", + "stdlib/xml/dom", + "stdlib/xml/sax", + "stubs/backports", + "stubs/backports_abc", + "stubs/boto", + "stubs/chardet", + "stubs/cryptography", + "stubs/dateparser", + "stubs/docutils", + "stubs/fb303", + "stubs/Flask", + "stubs/Jinja2", + "stubs/kazoo", + "stubs/Markdown", + "stubs/paramiko", + "stubs/protobuf", + "stubs/pymssql", + "stubs/PyMySQL", + "stubs/python-dateutil", + "stubs/pyvmomi", + "stubs/PyYAML", + "stubs/redis", + "stubs/requests", + "stubs/Routes", + "stubs/scribe", + "stubs/simplejson", + "stubs/tornado", + "stubs/waitress", + "stubs/Werkzeug" + ], + "typeCheckingMode": "basic", + "strictListInference": true, + "strictDictionaryInference": true, + "strictParameterNoneValue": true, + "reportFunctionMemberAccess": "error", + "reportMissingModuleSource": "none", + "reportMissingTypeStubs": "error", + "reportUnusedImport": "error", + "reportUnusedClass": "error", + "reportUnusedFunction": "error", + "reportUnusedVariable": "error", + "reportDuplicateImport": "error", + "reportOptionalSubscript": "error", + "reportOptionalMemberAccess": "error", + "reportOptionalCall": "error", + "reportOptionalIterable": "error", + "reportOptionalContextManager": "error", + "reportOptionalOperand": "error", + "reportUntypedFunctionDecorator": "error", + "reportUntypedClassDecorator": "error", + "reportUntypedBaseClass": "error", + "reportUntypedNamedTuple": "error", + "reportPrivateUsage": "error", + "reportConstantRedefinition": "error", + "reportIncompatibleMethodOverride": "error", + "reportIncompatibleVariableOverride": "error", + "reportInvalidStringEscapeSequence": "error", + "reportUnknownParameterType": "error", + "reportUnknownArgumentType": "error", + "reportUnknownLambdaType": "error", + "reportUnknownVariableType": "error", + "reportUnknownMemberType": "error", + "reportMissingTypeArgument": "error", + "reportUndefinedVariable": "error", + "reportUnboundVariable": "error", + "reportInvalidStubStatement": "error", + "reportUnsupportedDunderAll": "error", + "reportInvalidTypeVarUse": "none", + "reportOverlappingOverload": "none", + "reportPropertyTypeMismatch": "none", + "reportSelfClsParameterName": "none" +} \ No newline at end of file diff --git a/python/helpers/typeshed/requirements-tests-py3.txt b/python/helpers/typeshed/requirements-tests-py3.txt index b52d9c9729fe..ee24076de81d 100644 --- a/python/helpers/typeshed/requirements-tests-py3.txt +++ b/python/helpers/typeshed/requirements-tests-py3.txt @@ -5,4 +5,4 @@ flake8==3.8.4 flake8-bugbear==20.1.4 flake8-pyi==20.10.0 isort[pyproject]==5.5.3 -pytype>=2020.09.16 +pytype>=2021.01.28 diff --git a/python/helpers/typeshed/scripts/generate_proto_stubs.sh b/python/helpers/typeshed/scripts/generate_proto_stubs.sh index fdab8d2a122e..976745997335 100644 --- a/python/helpers/typeshed/scripts/generate_proto_stubs.sh +++ b/python/helpers/typeshed/scripts/generate_proto_stubs.sh @@ -1,10 +1,10 @@ #!/bin/bash -# Some of the proto .pyi stubs in third_party/2and3/google/protobuf/ +# Some of the proto .pyi stubs in stubs/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 +# stubs/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 # @@ -46,7 +46,7 @@ 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 +find $REPO_ROOT/stubs/protobuf/ -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. @@ -65,4 +65,4 @@ PROTO_FILES=$(grep "generate_proto.*google" $PYTHON_PROTOBUF_DIR/python/setup.py ) # And regenerate! -protoc_install/bin/protoc --proto_path=$PYTHON_PROTOBUF_DIR/src --mypy_out=$REPO_ROOT/third_party/2and3 $PROTO_FILES +protoc_install/bin/protoc --proto_path=$PYTHON_PROTOBUF_DIR/src --mypy_out=$REPO_ROOT/stubs/protobuf $PROTO_FILES diff --git a/python/helpers/typeshed/stdlib/2and3/cgi.pyi b/python/helpers/typeshed/stdlib/2and3/cgi.pyi deleted file mode 100644 index c868d6521f3d..000000000000 --- a/python/helpers/typeshed/stdlib/2and3/cgi.pyi +++ /dev/null @@ -1,162 +0,0 @@ -import sys -from _typeshed import SupportsGetItem, SupportsItemAccess -from builtins import type as _type -from typing import IO, Any, AnyStr, Dict, Iterable, Iterator, List, Mapping, Optional, Protocol, Tuple, TypeVar, Union - -_T = TypeVar("_T", bound=FieldStorage) - -def parse( - fp: Optional[IO[Any]] = ..., - environ: SupportsItemAccess[str, str] = ..., - keep_blank_values: bool = ..., - strict_parsing: bool = ..., -) -> Dict[str, List[str]]: ... - -if sys.version_info < (3, 8): - def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ... - def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> List[Tuple[str, str]]: ... - -if sys.version_info >= (3, 7): - def parse_multipart( - fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = ..., errors: str = ... - ) -> Dict[str, List[Any]]: ... - -else: - def parse_multipart(fp: IO[Any], pdict: SupportsGetItem[str, bytes]) -> Dict[str, List[bytes]]: ... - -class _Environ(Protocol): - def __getitem__(self, __k: str) -> str: ... - def keys(self) -> Iterable[str]: ... - -def parse_header(line: str) -> Tuple[str, Dict[str, str]]: ... -def test(environ: _Environ = ...) -> None: ... -def print_environ(environ: _Environ = ...) -> None: ... -def print_form(form: Dict[str, Any]) -> None: ... -def print_directory() -> None: ... -def print_environ_usage() -> None: ... - -if sys.version_info < (3,): - def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ... - -elif sys.version_info < (3, 8): - def escape(s: str, quote: Optional[bool] = ...) -> str: ... - -class MiniFieldStorage: - # The first five "Any" attributes here are always None, but mypy doesn't support that - filename: Any - list: Any - type: Any - file: Optional[IO[bytes]] - type_options: Dict[Any, Any] - disposition: Any - disposition_options: Dict[Any, Any] - headers: Dict[Any, Any] - name: Any - value: Any - def __init__(self, name: Any, value: Any) -> None: ... - def __repr__(self) -> str: ... - -class FieldStorage(object): - FieldStorageClass: Optional[_type] - keep_blank_values: int - strict_parsing: int - qs_on_post: Optional[str] - headers: Mapping[str, str] - fp: IO[bytes] - encoding: str - errors: str - outerboundary: bytes - bytes_read: int - limit: Optional[int] - disposition: str - disposition_options: Dict[str, str] - filename: Optional[str] - file: Optional[IO[bytes]] - type: str - type_options: Dict[str, str] - innerboundary: bytes - length: int - done: int - list: Optional[List[Any]] - value: Union[None, bytes, List[Any]] - - if sys.version_info >= (3, 6): - def __init__( - self, - fp: Optional[IO[Any]] = ..., - headers: Optional[Mapping[str, str]] = ..., - outerboundary: bytes = ..., - environ: SupportsGetItem[str, str] = ..., - keep_blank_values: int = ..., - strict_parsing: int = ..., - limit: Optional[int] = ..., - encoding: str = ..., - errors: str = ..., - max_num_fields: Optional[int] = ..., - ) -> None: ... - elif sys.version_info >= (3, 0): - def __init__( - self, - fp: Optional[IO[Any]] = ..., - headers: Optional[Mapping[str, str]] = ..., - outerboundary: bytes = ..., - environ: SupportsGetItem[str, str] = ..., - keep_blank_values: int = ..., - strict_parsing: int = ..., - limit: Optional[int] = ..., - encoding: str = ..., - errors: str = ..., - ) -> None: ... - else: - def __init__( - self, - fp: IO[Any] = ..., - headers: Mapping[str, str] = ..., - outerboundary: bytes = ..., - environ: SupportsGetItem[str, str] = ..., - keep_blank_values: int = ..., - strict_parsing: int = ..., - ) -> None: ... - if sys.version_info >= (3, 0): - def __enter__(self: _T) -> _T: ... - def __exit__(self, *args: Any) -> None: ... - def __repr__(self) -> str: ... - def __iter__(self) -> Iterator[str]: ... - def __getitem__(self, key: str) -> Any: ... - def getvalue(self, key: str, default: Any = ...) -> Any: ... - def getfirst(self, key: str, default: Any = ...) -> Any: ... - def getlist(self, key: str) -> List[Any]: ... - def keys(self) -> List[str]: ... - if sys.version_info < (3, 0): - def has_key(self, key: str) -> bool: ... - def __contains__(self, key: str) -> bool: ... - def __len__(self) -> int: ... - if sys.version_info >= (3, 0): - def __bool__(self) -> bool: ... - else: - def __nonzero__(self) -> bool: ... - if sys.version_info >= (3, 0): - # In Python 3 it returns bytes or str IO depending on an internal flag - def make_file(self) -> IO[Any]: ... - else: - # In Python 2 it always returns bytes and ignores the "binary" flag - def make_file(self, binary: Any = ...) -> IO[bytes]: ... - -if sys.version_info < (3, 0): - from UserDict import UserDict - class FormContentDict(UserDict[str, List[str]]): - query_string: str - def __init__(self, environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ... - class SvFormContentDict(FormContentDict): - def getlist(self, key: Any) -> Any: ... - class InterpFormContentDict(SvFormContentDict): ... - class FormContent(FormContentDict): - # TODO this should have - # def values(self, key: Any) -> Any: ... - # but this is incompatible with the supertype, and adding '# type: ignore' triggers - # a parse error in pytype (https://github.com/google/pytype/issues/53) - def indexed_value(self, key: Any, location: int) -> Any: ... - def value(self, key: Any) -> Any: ... - def length(self, key: Any) -> int: ... - def stripped(self, key: Any) -> Any: ... - def pars(self) -> Dict[Any, Any]: ... diff --git a/python/helpers/typeshed/stdlib/3/xxlimited.pyi b/python/helpers/typeshed/stdlib/3/xxlimited.pyi deleted file mode 100644 index e47694586ab1..000000000000 --- a/python/helpers/typeshed/stdlib/3/xxlimited.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from typing import Any - -class Null: ... -class Str: ... - -class Xxo: - def demo(self) -> None: ... - -class error: ... - -def foo(__i: int, __j: int) -> Any: ... -def new() -> Xxo: ... -def roj(__b: Any) -> None: ... diff --git a/python/helpers/typeshed/stdlib/2/ConfigParser.pyi b/python/helpers/typeshed/stdlib/@python2/ConfigParser.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/ConfigParser.pyi rename to python/helpers/typeshed/stdlib/@python2/ConfigParser.pyi diff --git a/python/helpers/typeshed/stdlib/2/Queue.pyi b/python/helpers/typeshed/stdlib/@python2/Queue.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/Queue.pyi rename to python/helpers/typeshed/stdlib/@python2/Queue.pyi diff --git a/python/helpers/typeshed/stdlib/2/SocketServer.pyi b/python/helpers/typeshed/stdlib/@python2/SocketServer.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/SocketServer.pyi rename to python/helpers/typeshed/stdlib/@python2/SocketServer.pyi diff --git a/python/helpers/typeshed/stdlib/2/__builtin__.pyi b/python/helpers/typeshed/stdlib/@python2/__builtin__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/__builtin__.pyi rename to python/helpers/typeshed/stdlib/@python2/__builtin__.pyi diff --git a/python/helpers/typeshed/stdlib/2/_io.pyi b/python/helpers/typeshed/stdlib/@python2/_io.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/_io.pyi rename to python/helpers/typeshed/stdlib/@python2/_io.pyi diff --git a/python/helpers/typeshed/stdlib/2/_json.pyi b/python/helpers/typeshed/stdlib/@python2/_json.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/_json.pyi rename to python/helpers/typeshed/stdlib/@python2/_json.pyi diff --git a/python/helpers/typeshed/stdlib/2/_winreg.pyi b/python/helpers/typeshed/stdlib/@python2/_winreg.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/_winreg.pyi rename to python/helpers/typeshed/stdlib/@python2/_winreg.pyi diff --git a/python/helpers/typeshed/stdlib/2/abc.pyi b/python/helpers/typeshed/stdlib/@python2/abc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/abc.pyi rename to python/helpers/typeshed/stdlib/@python2/abc.pyi diff --git a/python/helpers/typeshed/stdlib/2/ast.pyi b/python/helpers/typeshed/stdlib/@python2/ast.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/ast.pyi rename to python/helpers/typeshed/stdlib/@python2/ast.pyi diff --git a/python/helpers/typeshed/stdlib/2/builtins.pyi b/python/helpers/typeshed/stdlib/@python2/builtins.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/builtins.pyi rename to python/helpers/typeshed/stdlib/@python2/builtins.pyi diff --git a/python/helpers/typeshed/stdlib/2/cPickle.pyi b/python/helpers/typeshed/stdlib/@python2/cPickle.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/cPickle.pyi rename to python/helpers/typeshed/stdlib/@python2/cPickle.pyi diff --git a/python/helpers/typeshed/stdlib/@python2/cgi.pyi b/python/helpers/typeshed/stdlib/@python2/cgi.pyi new file mode 100644 index 000000000000..c3519bba9b20 --- /dev/null +++ b/python/helpers/typeshed/stdlib/@python2/cgi.pyi @@ -0,0 +1,109 @@ +from _typeshed import SupportsGetItem, SupportsItemAccess +from builtins import type as _type +from typing import IO, Any, AnyStr, Iterable, Iterator, List, Mapping, Optional, Protocol, TypeVar, Union +from UserDict import UserDict + +_T = TypeVar("_T", bound=FieldStorage) + +def parse( + fp: Optional[IO[Any]] = ..., + environ: SupportsItemAccess[str, str] = ..., + keep_blank_values: bool = ..., + strict_parsing: bool = ..., +) -> dict[str, List[str]]: ... +def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> dict[str, List[str]]: ... +def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> List[tuple[str, str]]: ... +def parse_multipart(fp: IO[Any], pdict: SupportsGetItem[str, bytes]) -> dict[str, List[bytes]]: ... + +class _Environ(Protocol): + def __getitem__(self, __k: str) -> str: ... + def keys(self) -> Iterable[str]: ... + +def parse_header(line: str) -> tuple[str, dict[str, str]]: ... +def test(environ: _Environ = ...) -> None: ... +def print_environ(environ: _Environ = ...) -> None: ... +def print_form(form: dict[str, Any]) -> None: ... +def print_directory() -> None: ... +def print_environ_usage() -> None: ... +def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ... + +class MiniFieldStorage: + # The first five "Any" attributes here are always None, but mypy doesn't support that + filename: Any + list: Any + type: Any + file: Optional[IO[bytes]] + type_options: dict[Any, Any] + disposition: Any + disposition_options: dict[Any, Any] + headers: dict[Any, Any] + name: Any + value: Any + def __init__(self, name: Any, value: Any) -> None: ... + def __repr__(self) -> str: ... + +class FieldStorage(object): + FieldStorageClass: Optional[_type] + keep_blank_values: int + strict_parsing: int + qs_on_post: Optional[str] + headers: Mapping[str, str] + fp: IO[bytes] + encoding: str + errors: str + outerboundary: bytes + bytes_read: int + limit: Optional[int] + disposition: str + disposition_options: dict[str, str] + filename: Optional[str] + file: Optional[IO[bytes]] + type: str + type_options: dict[str, str] + innerboundary: bytes + length: int + done: int + list: Optional[List[Any]] + value: Union[None, bytes, List[Any]] + def __init__( + self, + fp: IO[Any] = ..., + headers: Mapping[str, str] = ..., + outerboundary: bytes = ..., + environ: SupportsGetItem[str, str] = ..., + keep_blank_values: int = ..., + strict_parsing: int = ..., + ) -> None: ... + def __repr__(self) -> str: ... + def __iter__(self) -> Iterator[str]: ... + def __getitem__(self, key: str) -> Any: ... + def getvalue(self, key: str, default: Any = ...) -> Any: ... + def getfirst(self, key: str, default: Any = ...) -> Any: ... + def getlist(self, key: str) -> List[Any]: ... + def keys(self) -> List[str]: ... + def has_key(self, key: str) -> bool: ... + def __contains__(self, key: str) -> bool: ... + def __len__(self) -> int: ... + def __nonzero__(self) -> bool: ... + # In Python 2 it always returns bytes and ignores the "binary" flag + def make_file(self, binary: Any = ...) -> IO[bytes]: ... + +class FormContentDict(UserDict[str, List[str]]): + query_string: str + def __init__(self, environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ... + +class SvFormContentDict(FormContentDict): + def getlist(self, key: Any) -> Any: ... + +class InterpFormContentDict(SvFormContentDict): ... + +class FormContent(FormContentDict): + # TODO this should have + # def values(self, key: Any) -> Any: ... + # but this is incompatible with the supertype, and adding '# type: ignore' triggers + # a parse error in pytype (https://github.com/google/pytype/issues/53) + def indexed_value(self, key: Any, location: int) -> Any: ... + def value(self, key: Any) -> Any: ... + def length(self, key: Any) -> int: ... + def stripped(self, key: Any) -> Any: ... + def pars(self) -> dict[Any, Any]: ... diff --git a/python/helpers/typeshed/stdlib/2/collections.pyi b/python/helpers/typeshed/stdlib/@python2/collections.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/collections.pyi rename to python/helpers/typeshed/stdlib/@python2/collections.pyi diff --git a/python/helpers/typeshed/stdlib/2/compileall.pyi b/python/helpers/typeshed/stdlib/@python2/compileall.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/compileall.pyi rename to python/helpers/typeshed/stdlib/@python2/compileall.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/__init__.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/__init__.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/archive_util.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/archive_util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/archive_util.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/archive_util.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/bcppcompiler.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/bcppcompiler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/bcppcompiler.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/bcppcompiler.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/ccompiler.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/ccompiler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/ccompiler.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/ccompiler.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/cmd.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/cmd.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/cmd.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/cmd.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/__init__.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/__init__.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/bdist.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/bdist.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/bdist.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/bdist.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/bdist_dumb.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/bdist_dumb.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/bdist_dumb.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/bdist_dumb.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/bdist_msi.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/bdist_msi.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/bdist_msi.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/bdist_msi.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/bdist_packager.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/bdist_packager.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/bdist_packager.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/bdist_packager.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/bdist_rpm.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/bdist_rpm.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/bdist_rpm.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/bdist_rpm.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/bdist_wininst.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/bdist_wininst.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/bdist_wininst.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/bdist_wininst.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/build.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/build.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/build.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/build.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/build_clib.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/build_clib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/build_clib.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/build_clib.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/build_ext.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/build_ext.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/build_ext.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/build_ext.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/build_py.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/build_py.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/build_py.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/build_py.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/build_scripts.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/build_scripts.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/build_scripts.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/build_scripts.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/check.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/check.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/check.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/check.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/clean.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/clean.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/clean.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/clean.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/config.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/config.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/config.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/config.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/install.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/install.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/install.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/install.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/install_data.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/install_data.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/install_data.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/install_data.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/install_egg_info.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/install_egg_info.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/install_egg_info.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/install_egg_info.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/install_headers.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/install_headers.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/install_headers.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/install_headers.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/install_lib.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/install_lib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/install_lib.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/install_lib.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/install_scripts.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/install_scripts.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/install_scripts.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/install_scripts.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/register.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/register.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/register.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/register.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/sdist.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/sdist.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/sdist.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/sdist.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/command/upload.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/command/upload.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/command/upload.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/command/upload.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/config.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/config.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/config.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/config.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/core.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/core.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/core.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/core.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/cygwinccompiler.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/cygwinccompiler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/cygwinccompiler.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/cygwinccompiler.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/debug.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/debug.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/debug.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/debug.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/dep_util.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/dep_util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/dep_util.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/dep_util.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/dir_util.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/dir_util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/dir_util.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/dir_util.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/dist.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/dist.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/dist.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/dist.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/emxccompiler.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/emxccompiler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/emxccompiler.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/emxccompiler.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/errors.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/errors.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/errors.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/errors.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/extension.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/extension.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/extension.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/extension.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/fancy_getopt.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/fancy_getopt.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/fancy_getopt.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/fancy_getopt.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/file_util.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/file_util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/file_util.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/file_util.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/filelist.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/filelist.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/filelist.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/filelist.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/log.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/log.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/log.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/log.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/msvccompiler.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/msvccompiler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/msvccompiler.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/msvccompiler.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/spawn.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/spawn.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/spawn.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/spawn.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/sysconfig.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/sysconfig.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/sysconfig.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/sysconfig.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/text_file.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/text_file.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/text_file.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/text_file.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/unixccompiler.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/unixccompiler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/unixccompiler.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/unixccompiler.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/util.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/util.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/util.pyi diff --git a/python/helpers/typeshed/stdlib/2/distutils/version.pyi b/python/helpers/typeshed/stdlib/@python2/distutils/version.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/distutils/version.pyi rename to python/helpers/typeshed/stdlib/@python2/distutils/version.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/MIMEText.pyi b/python/helpers/typeshed/stdlib/@python2/email/MIMEText.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/MIMEText.pyi rename to python/helpers/typeshed/stdlib/@python2/email/MIMEText.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/__init__.pyi b/python/helpers/typeshed/stdlib/@python2/email/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/__init__.pyi rename to python/helpers/typeshed/stdlib/@python2/email/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/_parseaddr.pyi b/python/helpers/typeshed/stdlib/@python2/email/_parseaddr.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/_parseaddr.pyi rename to python/helpers/typeshed/stdlib/@python2/email/_parseaddr.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/base64mime.pyi b/python/helpers/typeshed/stdlib/@python2/email/base64mime.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/base64mime.pyi rename to python/helpers/typeshed/stdlib/@python2/email/base64mime.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/charset.pyi b/python/helpers/typeshed/stdlib/@python2/email/charset.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/charset.pyi rename to python/helpers/typeshed/stdlib/@python2/email/charset.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/encoders.pyi b/python/helpers/typeshed/stdlib/@python2/email/encoders.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/encoders.pyi rename to python/helpers/typeshed/stdlib/@python2/email/encoders.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/feedparser.pyi b/python/helpers/typeshed/stdlib/@python2/email/feedparser.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/feedparser.pyi rename to python/helpers/typeshed/stdlib/@python2/email/feedparser.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/generator.pyi b/python/helpers/typeshed/stdlib/@python2/email/generator.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/generator.pyi rename to python/helpers/typeshed/stdlib/@python2/email/generator.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/header.pyi b/python/helpers/typeshed/stdlib/@python2/email/header.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/header.pyi rename to python/helpers/typeshed/stdlib/@python2/email/header.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/iterators.pyi b/python/helpers/typeshed/stdlib/@python2/email/iterators.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/iterators.pyi rename to python/helpers/typeshed/stdlib/@python2/email/iterators.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/message.pyi b/python/helpers/typeshed/stdlib/@python2/email/message.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/message.pyi rename to python/helpers/typeshed/stdlib/@python2/email/message.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/mime/__init__.pyi b/python/helpers/typeshed/stdlib/@python2/email/mime/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/mime/__init__.pyi rename to python/helpers/typeshed/stdlib/@python2/email/mime/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/mime/application.pyi b/python/helpers/typeshed/stdlib/@python2/email/mime/application.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/mime/application.pyi rename to python/helpers/typeshed/stdlib/@python2/email/mime/application.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/mime/audio.pyi b/python/helpers/typeshed/stdlib/@python2/email/mime/audio.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/mime/audio.pyi rename to python/helpers/typeshed/stdlib/@python2/email/mime/audio.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/mime/base.pyi b/python/helpers/typeshed/stdlib/@python2/email/mime/base.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/mime/base.pyi rename to python/helpers/typeshed/stdlib/@python2/email/mime/base.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/mime/image.pyi b/python/helpers/typeshed/stdlib/@python2/email/mime/image.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/mime/image.pyi rename to python/helpers/typeshed/stdlib/@python2/email/mime/image.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/mime/message.pyi b/python/helpers/typeshed/stdlib/@python2/email/mime/message.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/mime/message.pyi rename to python/helpers/typeshed/stdlib/@python2/email/mime/message.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/mime/multipart.pyi b/python/helpers/typeshed/stdlib/@python2/email/mime/multipart.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/mime/multipart.pyi rename to python/helpers/typeshed/stdlib/@python2/email/mime/multipart.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/mime/nonmultipart.pyi b/python/helpers/typeshed/stdlib/@python2/email/mime/nonmultipart.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/mime/nonmultipart.pyi rename to python/helpers/typeshed/stdlib/@python2/email/mime/nonmultipart.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/mime/text.pyi b/python/helpers/typeshed/stdlib/@python2/email/mime/text.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/mime/text.pyi rename to python/helpers/typeshed/stdlib/@python2/email/mime/text.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/parser.pyi b/python/helpers/typeshed/stdlib/@python2/email/parser.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/parser.pyi rename to python/helpers/typeshed/stdlib/@python2/email/parser.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/quoprimime.pyi b/python/helpers/typeshed/stdlib/@python2/email/quoprimime.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/quoprimime.pyi rename to python/helpers/typeshed/stdlib/@python2/email/quoprimime.pyi diff --git a/python/helpers/typeshed/stdlib/2/email/utils.pyi b/python/helpers/typeshed/stdlib/@python2/email/utils.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/email/utils.pyi rename to python/helpers/typeshed/stdlib/@python2/email/utils.pyi diff --git a/python/helpers/typeshed/stdlib/2/exceptions.pyi b/python/helpers/typeshed/stdlib/@python2/exceptions.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/exceptions.pyi rename to python/helpers/typeshed/stdlib/@python2/exceptions.pyi diff --git a/python/helpers/typeshed/stdlib/2/fcntl.pyi b/python/helpers/typeshed/stdlib/@python2/fcntl.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/fcntl.pyi rename to python/helpers/typeshed/stdlib/@python2/fcntl.pyi diff --git a/python/helpers/typeshed/stdlib/2/functools.pyi b/python/helpers/typeshed/stdlib/@python2/functools.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/functools.pyi rename to python/helpers/typeshed/stdlib/@python2/functools.pyi diff --git a/python/helpers/typeshed/stdlib/2/gc.pyi b/python/helpers/typeshed/stdlib/@python2/gc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/gc.pyi rename to python/helpers/typeshed/stdlib/@python2/gc.pyi diff --git a/python/helpers/typeshed/stdlib/2/gettext.pyi b/python/helpers/typeshed/stdlib/@python2/gettext.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/gettext.pyi rename to python/helpers/typeshed/stdlib/@python2/gettext.pyi diff --git a/python/helpers/typeshed/stdlib/2/hashlib.pyi b/python/helpers/typeshed/stdlib/@python2/hashlib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/hashlib.pyi rename to python/helpers/typeshed/stdlib/@python2/hashlib.pyi diff --git a/python/helpers/typeshed/stdlib/2/heapq.pyi b/python/helpers/typeshed/stdlib/@python2/heapq.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/heapq.pyi rename to python/helpers/typeshed/stdlib/@python2/heapq.pyi diff --git a/python/helpers/typeshed/stdlib/2/importlib.pyi b/python/helpers/typeshed/stdlib/@python2/importlib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/importlib.pyi rename to python/helpers/typeshed/stdlib/@python2/importlib.pyi diff --git a/python/helpers/typeshed/stdlib/2/inspect.pyi b/python/helpers/typeshed/stdlib/@python2/inspect.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/inspect.pyi rename to python/helpers/typeshed/stdlib/@python2/inspect.pyi diff --git a/python/helpers/typeshed/stdlib/2/io.pyi b/python/helpers/typeshed/stdlib/@python2/io.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/io.pyi rename to python/helpers/typeshed/stdlib/@python2/io.pyi diff --git a/python/helpers/typeshed/stdlib/2/itertools.pyi b/python/helpers/typeshed/stdlib/@python2/itertools.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/itertools.pyi rename to python/helpers/typeshed/stdlib/@python2/itertools.pyi diff --git a/python/helpers/typeshed/stdlib/2/json.pyi b/python/helpers/typeshed/stdlib/@python2/json.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/json.pyi rename to python/helpers/typeshed/stdlib/@python2/json.pyi diff --git a/python/helpers/typeshed/stdlib/2/multiprocessing/__init__.pyi b/python/helpers/typeshed/stdlib/@python2/multiprocessing/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/multiprocessing/__init__.pyi rename to python/helpers/typeshed/stdlib/@python2/multiprocessing/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2/multiprocessing/dummy/__init__.pyi b/python/helpers/typeshed/stdlib/@python2/multiprocessing/dummy/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/multiprocessing/dummy/__init__.pyi rename to python/helpers/typeshed/stdlib/@python2/multiprocessing/dummy/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2/multiprocessing/dummy/connection.pyi b/python/helpers/typeshed/stdlib/@python2/multiprocessing/dummy/connection.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/multiprocessing/dummy/connection.pyi rename to python/helpers/typeshed/stdlib/@python2/multiprocessing/dummy/connection.pyi diff --git a/python/helpers/typeshed/stdlib/2/multiprocessing/pool.pyi b/python/helpers/typeshed/stdlib/@python2/multiprocessing/pool.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/multiprocessing/pool.pyi rename to python/helpers/typeshed/stdlib/@python2/multiprocessing/pool.pyi diff --git a/python/helpers/typeshed/stdlib/2/multiprocessing/process.pyi b/python/helpers/typeshed/stdlib/@python2/multiprocessing/process.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/multiprocessing/process.pyi rename to python/helpers/typeshed/stdlib/@python2/multiprocessing/process.pyi diff --git a/python/helpers/typeshed/stdlib/2/multiprocessing/util.pyi b/python/helpers/typeshed/stdlib/@python2/multiprocessing/util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/multiprocessing/util.pyi rename to python/helpers/typeshed/stdlib/@python2/multiprocessing/util.pyi diff --git a/python/helpers/typeshed/stdlib/2/ntpath.pyi b/python/helpers/typeshed/stdlib/@python2/ntpath.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/ntpath.pyi rename to python/helpers/typeshed/stdlib/@python2/ntpath.pyi diff --git a/python/helpers/typeshed/stdlib/2/os/__init__.pyi b/python/helpers/typeshed/stdlib/@python2/os/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/os/__init__.pyi rename to python/helpers/typeshed/stdlib/@python2/os/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2/os/path.pyi b/python/helpers/typeshed/stdlib/@python2/os/path.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/os/path.pyi rename to python/helpers/typeshed/stdlib/@python2/os/path.pyi diff --git a/python/helpers/typeshed/stdlib/2/os2emxpath.pyi b/python/helpers/typeshed/stdlib/@python2/os2emxpath.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/os2emxpath.pyi rename to python/helpers/typeshed/stdlib/@python2/os2emxpath.pyi diff --git a/python/helpers/typeshed/stdlib/2/pipes.pyi b/python/helpers/typeshed/stdlib/@python2/pipes.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/pipes.pyi rename to python/helpers/typeshed/stdlib/@python2/pipes.pyi diff --git a/python/helpers/typeshed/stdlib/2/posix.pyi b/python/helpers/typeshed/stdlib/@python2/posix.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/posix.pyi rename to python/helpers/typeshed/stdlib/@python2/posix.pyi diff --git a/python/helpers/typeshed/stdlib/2/posixpath.pyi b/python/helpers/typeshed/stdlib/@python2/posixpath.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/posixpath.pyi rename to python/helpers/typeshed/stdlib/@python2/posixpath.pyi diff --git a/python/helpers/typeshed/stdlib/2/random.pyi b/python/helpers/typeshed/stdlib/@python2/random.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/random.pyi rename to python/helpers/typeshed/stdlib/@python2/random.pyi diff --git a/python/helpers/typeshed/stdlib/2/re.pyi b/python/helpers/typeshed/stdlib/@python2/re.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/re.pyi rename to python/helpers/typeshed/stdlib/@python2/re.pyi diff --git a/python/helpers/typeshed/stdlib/2/resource.pyi b/python/helpers/typeshed/stdlib/@python2/resource.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/resource.pyi rename to python/helpers/typeshed/stdlib/@python2/resource.pyi diff --git a/python/helpers/typeshed/stdlib/2/signal.pyi b/python/helpers/typeshed/stdlib/@python2/signal.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/signal.pyi rename to python/helpers/typeshed/stdlib/@python2/signal.pyi diff --git a/python/helpers/typeshed/stdlib/2/sre_constants.pyi b/python/helpers/typeshed/stdlib/@python2/sre_constants.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/sre_constants.pyi rename to python/helpers/typeshed/stdlib/@python2/sre_constants.pyi diff --git a/python/helpers/typeshed/stdlib/2/sre_parse.pyi b/python/helpers/typeshed/stdlib/@python2/sre_parse.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/sre_parse.pyi rename to python/helpers/typeshed/stdlib/@python2/sre_parse.pyi diff --git a/python/helpers/typeshed/stdlib/2/subprocess.pyi b/python/helpers/typeshed/stdlib/@python2/subprocess.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/subprocess.pyi rename to python/helpers/typeshed/stdlib/@python2/subprocess.pyi diff --git a/python/helpers/typeshed/stdlib/2/sys.pyi b/python/helpers/typeshed/stdlib/@python2/sys.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/sys.pyi rename to python/helpers/typeshed/stdlib/@python2/sys.pyi diff --git a/python/helpers/typeshed/stdlib/2/tempfile.pyi b/python/helpers/typeshed/stdlib/@python2/tempfile.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/tempfile.pyi rename to python/helpers/typeshed/stdlib/@python2/tempfile.pyi diff --git a/python/helpers/typeshed/stdlib/2/textwrap.pyi b/python/helpers/typeshed/stdlib/@python2/textwrap.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/textwrap.pyi rename to python/helpers/typeshed/stdlib/@python2/textwrap.pyi diff --git a/python/helpers/typeshed/stdlib/2/tokenize.pyi b/python/helpers/typeshed/stdlib/@python2/tokenize.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/tokenize.pyi rename to python/helpers/typeshed/stdlib/@python2/tokenize.pyi diff --git a/python/helpers/typeshed/stdlib/2/types.pyi b/python/helpers/typeshed/stdlib/@python2/types.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/types.pyi rename to python/helpers/typeshed/stdlib/@python2/types.pyi diff --git a/python/helpers/typeshed/stdlib/2/typing.pyi b/python/helpers/typeshed/stdlib/@python2/typing.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/typing.pyi rename to python/helpers/typeshed/stdlib/@python2/typing.pyi diff --git a/python/helpers/typeshed/stdlib/2/unittest.pyi b/python/helpers/typeshed/stdlib/@python2/unittest.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/unittest.pyi rename to python/helpers/typeshed/stdlib/@python2/unittest.pyi diff --git a/python/helpers/typeshed/stdlib/2/urllib.pyi b/python/helpers/typeshed/stdlib/@python2/urllib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/urllib.pyi rename to python/helpers/typeshed/stdlib/@python2/urllib.pyi diff --git a/python/helpers/typeshed/stdlib/2/urlparse.pyi b/python/helpers/typeshed/stdlib/@python2/urlparse.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2/urlparse.pyi rename to python/helpers/typeshed/stdlib/@python2/urlparse.pyi diff --git a/python/helpers/typeshed/stdlib/VERSIONS b/python/helpers/typeshed/stdlib/VERSIONS new file mode 100644 index 000000000000..49badfa47a32 --- /dev/null +++ b/python/helpers/typeshed/stdlib/VERSIONS @@ -0,0 +1,257 @@ +__future__: 2.7 +_ast: 3.6 +_bisect: 2.7 +_bootlocale: 3.6 +_codecs: 2.7 +_collections_abc: 3.6 +_compat_pickle: 3.6 +_compression: 3.6 +_csv: 2.7 +_curses: 2.7 +_decimal: 3.6 +_dummy_thread: 3.6 +_dummy_threading: 2.7 +_heapq: 2.7 +_imp: 3.6 +_importlib_modulespec: 3.6 +_json: 3.6 +_markupbase: 3.6 +_msi: 2.7 +_operator: 3.6 +_osx_support: 3.6 +_posixsubprocess: 3.6 +_py_abc: 3.7 +_pydecimal: 3.6 +_random: 2.7 +_sitebuiltins: 3.6 +_stat: 3.6 +_thread: 3.6 +_threading_local: 3.6 +_tkinter: 3.6 +_tracemalloc: 3.6 +_typeshed: 2.7 +_warnings: 2.7 +_weakref: 2.7 +_weakrefset: 2.7 +_winapi: 3.6 +abc: 3.6 +aifc: 2.7 +antigravity: 2.7 +argparse: 2.7 +array: 2.7 +ast: 3.6 +asynchat: 2.7 +asyncio: 3.6 +asyncore: 2.7 +atexit: 3.6 +audioop: 2.7 +base64: 2.7 +bdb: 2.7 +binascii: 2.7 +binhex: 2.7 +bisect: 2.7 +builtins: 3.6 +bz2: 2.7 +cProfile: 2.7 +calendar: 2.7 +cgi: 3.6 +cgitb: 2.7 +chunk: 2.7 +cmath: 2.7 +cmd: 2.7 +code: 2.7 +codecs: 2.7 +codeop: 2.7 +collections: 3.6 +colorsys: 2.7 +compileall: 3.6 +concurrent: 3.6 +configparser: 3.6 +contextlib: 2.7 +contextvars: 3.7 +copy: 2.7 +copyreg: 3.6 +crypt: 2.7 +csv: 2.7 +ctypes: 2.7 +curses: 2.7 +dataclasses: 3.7 +datetime: 2.7 +dbm: 3.6 +decimal: 2.7 +difflib: 2.7 +dis: 2.7 +distutils: 3.6 +doctest: 2.7 +dummy_threading: 2.7 +email: 3.6 +encodings: 3.6 +ensurepip: 2.7 +enum: 3.6 +errno: 2.7 +faulthandler: 3.6 +fcntl: 3.6 +filecmp: 2.7 +fileinput: 2.7 +fnmatch: 3.6 +formatter: 2.7 +fractions: 2.7 +ftplib: 2.7 +functools: 3.6 +gc: 3.6 +genericpath: 2.7 +getopt: 3.6 +getpass: 3.6 +gettext: 3.6 +glob: 3.6 +graphlib: 3.9 +grp: 2.7 +gzip: 3.6 +hashlib: 3.6 +heapq: 3.6 +hmac: 2.7 +html: 3.6 +http: 3.6 +imaplib: 2.7 +imghdr: 2.7 +imp: 3.6 +importlib: 3.6 +inspect: 3.6 +io: 3.6 +ipaddress: 3.6 +itertools: 3.6 +json: 3.6 +keyword: 2.7 +lib2to3: 2.7 +linecache: 2.7 +locale: 2.7 +logging: 2.7 +lzma: 3.6 +macpath: 2.7 +macurl2path: 3.6 +mailbox: 2.7 +mailcap: 2.7 +marshal: 2.7 +math: 2.7 +mimetypes: 2.7 +mmap: 2.7 +modulefinder: 2.7 +msilib: 2.7 +msvcrt: 2.7 +multiprocessing: 3.6 +netrc: 2.7 +nis: 2.7 +nntplib: 3.6 +ntpath: 3.6 +nturl2path: 3.6 +numbers: 2.7 +opcode: 2.7 +operator: 2.7 +optparse: 2.7 +os: 3.6 +ossaudiodev: 3.6 +parser: 2.7 +pathlib: 3.6 +pdb: 2.7 +pickle: 2.7 +pickletools: 2.7 +pipes: 3.6 +pkgutil: 2.7 +platform: 3.6 +plistlib: 2.7 +poplib: 2.7 +posix: 3.6 +posixpath: 3.6 +pprint: 2.7 +profile: 2.7 +pstats: 2.7 +pty: 2.7 +pwd: 2.7 +py_compile: 2.7 +pyclbr: 2.7 +pydoc: 2.7 +pydoc_data: 2.7 +pyexpat: 2.7 +queue: 3.6 +quopri: 2.7 +random: 3.6 +re: 3.6 +readline: 2.7 +reprlib: 3.6 +resource: 3.6 +rlcompleter: 2.7 +runpy: 3.6 +sched: 2.7 +secrets: 3.6 +select: 2.7 +selectors: 3.6 +shelve: 3.6 +shlex: 3.6 +shutil: 2.7 +signal: 3.6 +site: 2.7 +smtpd: 2.7 +smtplib: 3.6 +sndhdr: 2.7 +socket: 2.7 +socketserver: 3.6 +spwd: 3.6 +sqlite3: 2.7 +sre_compile: 2.7 +sre_constants: 3.6 +sre_parse: 3.6 +ssl: 2.7 +stat: 3.6 +statistics: 3.6 +string: 3.6 +stringprep: 2.7 +struct: 2.7 +subprocess: 3.6 +sunau: 2.7 +symbol: 3.6 +symtable: 2.7 +sys: 3.6 +sysconfig: 2.7 +syslog: 2.7 +tabnanny: 2.7 +tarfile: 2.7 +telnetlib: 2.7 +tempfile: 3.6 +termios: 2.7 +textwrap: 3.6 +this: 2.7 +threading: 2.7 +time: 2.7 +timeit: 2.7 +tkinter: 3.6 +token: 2.7 +tokenize: 3.6 +trace: 2.7 +traceback: 2.7 +tracemalloc: 3.6 +tty: 2.7 +turtle: 2.7 +types: 3.6 +typing: 3.6 +unicodedata: 2.7 +unittest: 3.6 +urllib: 3.6 +uu: 2.7 +uuid: 2.7 +venv: 3.6 +warnings: 2.7 +wave: 2.7 +weakref: 2.7 +webbrowser: 2.7 +winreg: 3.6 +winsound: 2.7 +wsgiref: 2.7 +xdrlib: 2.7 +xml: 2.7 +xmlrpc: 3.6 +xxlimited: 3.6 +zipapp: 3.6 +zipfile: 2.7 +zipimport: 2.7 +zlib: 2.7 +zoneinfo: 3.9 diff --git a/python/helpers/typeshed/stdlib/2and3/__future__.pyi b/python/helpers/typeshed/stdlib/__future__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/__future__.pyi rename to python/helpers/typeshed/stdlib/__future__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_bisect.pyi b/python/helpers/typeshed/stdlib/_bisect.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_bisect.pyi rename to python/helpers/typeshed/stdlib/_bisect.pyi diff --git a/python/helpers/typeshed/stdlib/3/_bootlocale.pyi b/python/helpers/typeshed/stdlib/_bootlocale.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_bootlocale.pyi rename to python/helpers/typeshed/stdlib/_bootlocale.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_codecs.pyi b/python/helpers/typeshed/stdlib/_codecs.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_codecs.pyi rename to python/helpers/typeshed/stdlib/_codecs.pyi diff --git a/python/helpers/typeshed/stdlib/3/_collections_abc.pyi b/python/helpers/typeshed/stdlib/_collections_abc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_collections_abc.pyi rename to python/helpers/typeshed/stdlib/_collections_abc.pyi diff --git a/python/helpers/typeshed/stdlib/3/_compat_pickle.pyi b/python/helpers/typeshed/stdlib/_compat_pickle.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_compat_pickle.pyi rename to python/helpers/typeshed/stdlib/_compat_pickle.pyi diff --git a/python/helpers/typeshed/stdlib/3/_compression.pyi b/python/helpers/typeshed/stdlib/_compression.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_compression.pyi rename to python/helpers/typeshed/stdlib/_compression.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_csv.pyi b/python/helpers/typeshed/stdlib/_csv.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_csv.pyi rename to python/helpers/typeshed/stdlib/_csv.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_curses.pyi b/python/helpers/typeshed/stdlib/_curses.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_curses.pyi rename to python/helpers/typeshed/stdlib/_curses.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_dummy_threading.pyi b/python/helpers/typeshed/stdlib/_dummy_threading.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_dummy_threading.pyi rename to python/helpers/typeshed/stdlib/_dummy_threading.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_heapq.pyi b/python/helpers/typeshed/stdlib/_heapq.pyi similarity index 92% rename from python/helpers/typeshed/stdlib/2and3/_heapq.pyi rename to python/helpers/typeshed/stdlib/_heapq.pyi index 673c03e80047..5b14a9de773d 100644 --- a/python/helpers/typeshed/stdlib/2and3/_heapq.pyi +++ b/python/helpers/typeshed/stdlib/_heapq.pyi @@ -3,7 +3,7 @@ from typing import Any, Callable, Iterable, List, Optional, TypeVar _T = TypeVar("_T") -def heapify(__heap: List[_T]) -> None: ... +def heapify(__heap: List[Any]) -> None: ... def heappop(__heap: List[_T]) -> _T: ... def heappush(__heap: List[_T], __item: _T) -> None: ... def heappushpop(__heap: List[_T], __item: _T) -> _T: ... diff --git a/python/helpers/typeshed/stdlib/3/_imp.pyi b/python/helpers/typeshed/stdlib/_imp.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_imp.pyi rename to python/helpers/typeshed/stdlib/_imp.pyi diff --git a/python/helpers/typeshed/stdlib/3/_importlib_modulespec.pyi b/python/helpers/typeshed/stdlib/_importlib_modulespec.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_importlib_modulespec.pyi rename to python/helpers/typeshed/stdlib/_importlib_modulespec.pyi diff --git a/python/helpers/typeshed/stdlib/3/_json.pyi b/python/helpers/typeshed/stdlib/_json.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_json.pyi rename to python/helpers/typeshed/stdlib/_json.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_msi.pyi b/python/helpers/typeshed/stdlib/_msi.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_msi.pyi rename to python/helpers/typeshed/stdlib/_msi.pyi diff --git a/python/helpers/typeshed/stdlib/3/_operator.pyi b/python/helpers/typeshed/stdlib/_operator.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_operator.pyi rename to python/helpers/typeshed/stdlib/_operator.pyi diff --git a/python/helpers/typeshed/stdlib/3.7/_py_abc.pyi b/python/helpers/typeshed/stdlib/_py_abc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3.7/_py_abc.pyi rename to python/helpers/typeshed/stdlib/_py_abc.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_random.pyi b/python/helpers/typeshed/stdlib/_random.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_random.pyi rename to python/helpers/typeshed/stdlib/_random.pyi diff --git a/python/helpers/typeshed/stdlib/3/_sitebuiltins.pyi b/python/helpers/typeshed/stdlib/_sitebuiltins.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_sitebuiltins.pyi rename to python/helpers/typeshed/stdlib/_sitebuiltins.pyi diff --git a/python/helpers/typeshed/stdlib/3/_thread.pyi b/python/helpers/typeshed/stdlib/_thread.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_thread.pyi rename to python/helpers/typeshed/stdlib/_thread.pyi diff --git a/python/helpers/typeshed/stdlib/3/_tkinter.pyi b/python/helpers/typeshed/stdlib/_tkinter.pyi similarity index 95% rename from python/helpers/typeshed/stdlib/3/_tkinter.pyi rename to python/helpers/typeshed/stdlib/_tkinter.pyi index c5bf5820a898..378b04202c4f 100644 --- a/python/helpers/typeshed/stdlib/3/_tkinter.pyi +++ b/python/helpers/typeshed/stdlib/_tkinter.pyi @@ -1,4 +1,4 @@ -from typing import Any, Tuple, Union +from typing import Any from typing_extensions import Literal # _tkinter is meant to be only used internally by tkinter, but some tkinter @@ -39,7 +39,7 @@ class TclError(Exception): ... # Tkapp_UnicodeResult, and it returns a string when it succeeds. class TkappType: # Please keep in sync with tkinter.Tk - def call(self, __command: Union[str, Tuple[Any, ...]], *args: Any) -> Any: ... + def call(self, __command: Any, *args: Any) -> Any: ... def eval(self, __script: str) -> str: ... adderrorinfo: Any createcommand: Any diff --git a/python/helpers/typeshed/stdlib/3/_tracemalloc.pyi b/python/helpers/typeshed/stdlib/_tracemalloc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_tracemalloc.pyi rename to python/helpers/typeshed/stdlib/_tracemalloc.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_typeshed/__init__.pyi b/python/helpers/typeshed/stdlib/_typeshed/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_typeshed/__init__.pyi rename to python/helpers/typeshed/stdlib/_typeshed/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_typeshed/tkinter.pyi b/python/helpers/typeshed/stdlib/_typeshed/tkinter.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_typeshed/tkinter.pyi rename to python/helpers/typeshed/stdlib/_typeshed/tkinter.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_typeshed/wsgi.pyi b/python/helpers/typeshed/stdlib/_typeshed/wsgi.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_typeshed/wsgi.pyi rename to python/helpers/typeshed/stdlib/_typeshed/wsgi.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_typeshed/xml.pyi b/python/helpers/typeshed/stdlib/_typeshed/xml.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_typeshed/xml.pyi rename to python/helpers/typeshed/stdlib/_typeshed/xml.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/_warnings.pyi b/python/helpers/typeshed/stdlib/_warnings.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/_warnings.pyi rename to python/helpers/typeshed/stdlib/_warnings.pyi diff --git a/python/helpers/typeshed/stdlib/3/_winapi.pyi b/python/helpers/typeshed/stdlib/_winapi.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/_winapi.pyi rename to python/helpers/typeshed/stdlib/_winapi.pyi diff --git a/python/helpers/typeshed/stdlib/3/abc.pyi b/python/helpers/typeshed/stdlib/abc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/abc.pyi rename to python/helpers/typeshed/stdlib/abc.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/aifc.pyi b/python/helpers/typeshed/stdlib/aifc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/aifc.pyi rename to python/helpers/typeshed/stdlib/aifc.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/antigravity.pyi b/python/helpers/typeshed/stdlib/antigravity.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/antigravity.pyi rename to python/helpers/typeshed/stdlib/antigravity.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/argparse.pyi b/python/helpers/typeshed/stdlib/argparse.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/argparse.pyi rename to python/helpers/typeshed/stdlib/argparse.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/array.pyi b/python/helpers/typeshed/stdlib/array.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/array.pyi rename to python/helpers/typeshed/stdlib/array.pyi diff --git a/python/helpers/typeshed/stdlib/3/ast.pyi b/python/helpers/typeshed/stdlib/ast.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/ast.pyi rename to python/helpers/typeshed/stdlib/ast.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/__init__.pyi b/python/helpers/typeshed/stdlib/asyncio/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/__init__.pyi rename to python/helpers/typeshed/stdlib/asyncio/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/base_events.pyi b/python/helpers/typeshed/stdlib/asyncio/base_events.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/base_events.pyi rename to python/helpers/typeshed/stdlib/asyncio/base_events.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/base_futures.pyi b/python/helpers/typeshed/stdlib/asyncio/base_futures.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/base_futures.pyi rename to python/helpers/typeshed/stdlib/asyncio/base_futures.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/base_subprocess.pyi b/python/helpers/typeshed/stdlib/asyncio/base_subprocess.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/base_subprocess.pyi rename to python/helpers/typeshed/stdlib/asyncio/base_subprocess.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/base_tasks.pyi b/python/helpers/typeshed/stdlib/asyncio/base_tasks.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/base_tasks.pyi rename to python/helpers/typeshed/stdlib/asyncio/base_tasks.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/compat.pyi b/python/helpers/typeshed/stdlib/asyncio/compat.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/compat.pyi rename to python/helpers/typeshed/stdlib/asyncio/compat.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/constants.pyi b/python/helpers/typeshed/stdlib/asyncio/constants.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/constants.pyi rename to python/helpers/typeshed/stdlib/asyncio/constants.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/coroutines.pyi b/python/helpers/typeshed/stdlib/asyncio/coroutines.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/coroutines.pyi rename to python/helpers/typeshed/stdlib/asyncio/coroutines.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/events.pyi b/python/helpers/typeshed/stdlib/asyncio/events.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/events.pyi rename to python/helpers/typeshed/stdlib/asyncio/events.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/exceptions.pyi b/python/helpers/typeshed/stdlib/asyncio/exceptions.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/exceptions.pyi rename to python/helpers/typeshed/stdlib/asyncio/exceptions.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/format_helpers.pyi b/python/helpers/typeshed/stdlib/asyncio/format_helpers.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/format_helpers.pyi rename to python/helpers/typeshed/stdlib/asyncio/format_helpers.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/futures.pyi b/python/helpers/typeshed/stdlib/asyncio/futures.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/futures.pyi rename to python/helpers/typeshed/stdlib/asyncio/futures.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/locks.pyi b/python/helpers/typeshed/stdlib/asyncio/locks.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/locks.pyi rename to python/helpers/typeshed/stdlib/asyncio/locks.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/log.pyi b/python/helpers/typeshed/stdlib/asyncio/log.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/log.pyi rename to python/helpers/typeshed/stdlib/asyncio/log.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/proactor_events.pyi b/python/helpers/typeshed/stdlib/asyncio/proactor_events.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/proactor_events.pyi rename to python/helpers/typeshed/stdlib/asyncio/proactor_events.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/protocols.pyi b/python/helpers/typeshed/stdlib/asyncio/protocols.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/protocols.pyi rename to python/helpers/typeshed/stdlib/asyncio/protocols.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/queues.pyi b/python/helpers/typeshed/stdlib/asyncio/queues.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/queues.pyi rename to python/helpers/typeshed/stdlib/asyncio/queues.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/runners.pyi b/python/helpers/typeshed/stdlib/asyncio/runners.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/runners.pyi rename to python/helpers/typeshed/stdlib/asyncio/runners.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/selector_events.pyi b/python/helpers/typeshed/stdlib/asyncio/selector_events.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/selector_events.pyi rename to python/helpers/typeshed/stdlib/asyncio/selector_events.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/sslproto.pyi b/python/helpers/typeshed/stdlib/asyncio/sslproto.pyi similarity index 99% rename from python/helpers/typeshed/stdlib/3/asyncio/sslproto.pyi rename to python/helpers/typeshed/stdlib/asyncio/sslproto.pyi index 8d1c44aee7e8..a267736ec997 100644 --- a/python/helpers/typeshed/stdlib/3/asyncio/sslproto.pyi +++ b/python/helpers/typeshed/stdlib/asyncio/sslproto.pyi @@ -106,7 +106,7 @@ class SSLProtocol(protocols.Protocol): loop: events.AbstractEventLoop, app_protocol: protocols.BaseProtocol, sslcontext: ssl.SSLContext, - waiter: futures.Future, + waiter: futures.Future[Any], server_side: bool = ..., server_hostname: Optional[str] = ..., call_connection_made: bool = ..., diff --git a/python/helpers/typeshed/stdlib/3/asyncio/staggered.pyi b/python/helpers/typeshed/stdlib/asyncio/staggered.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/staggered.pyi rename to python/helpers/typeshed/stdlib/asyncio/staggered.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/streams.pyi b/python/helpers/typeshed/stdlib/asyncio/streams.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/streams.pyi rename to python/helpers/typeshed/stdlib/asyncio/streams.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/subprocess.pyi b/python/helpers/typeshed/stdlib/asyncio/subprocess.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/subprocess.pyi rename to python/helpers/typeshed/stdlib/asyncio/subprocess.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/tasks.pyi b/python/helpers/typeshed/stdlib/asyncio/tasks.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/tasks.pyi rename to python/helpers/typeshed/stdlib/asyncio/tasks.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/threads.pyi b/python/helpers/typeshed/stdlib/asyncio/threads.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/threads.pyi rename to python/helpers/typeshed/stdlib/asyncio/threads.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/transports.pyi b/python/helpers/typeshed/stdlib/asyncio/transports.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/transports.pyi rename to python/helpers/typeshed/stdlib/asyncio/transports.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/trsock.pyi b/python/helpers/typeshed/stdlib/asyncio/trsock.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/trsock.pyi rename to python/helpers/typeshed/stdlib/asyncio/trsock.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/unix_events.pyi b/python/helpers/typeshed/stdlib/asyncio/unix_events.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/unix_events.pyi rename to python/helpers/typeshed/stdlib/asyncio/unix_events.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/windows_events.pyi b/python/helpers/typeshed/stdlib/asyncio/windows_events.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/windows_events.pyi rename to python/helpers/typeshed/stdlib/asyncio/windows_events.pyi diff --git a/python/helpers/typeshed/stdlib/3/asyncio/windows_utils.pyi b/python/helpers/typeshed/stdlib/asyncio/windows_utils.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/asyncio/windows_utils.pyi rename to python/helpers/typeshed/stdlib/asyncio/windows_utils.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/asyncore.pyi b/python/helpers/typeshed/stdlib/asyncore.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/asyncore.pyi rename to python/helpers/typeshed/stdlib/asyncore.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/audioop.pyi b/python/helpers/typeshed/stdlib/audioop.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/audioop.pyi rename to python/helpers/typeshed/stdlib/audioop.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/base64.pyi b/python/helpers/typeshed/stdlib/base64.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/base64.pyi rename to python/helpers/typeshed/stdlib/base64.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/bdb.pyi b/python/helpers/typeshed/stdlib/bdb.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/bdb.pyi rename to python/helpers/typeshed/stdlib/bdb.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/binascii.pyi b/python/helpers/typeshed/stdlib/binascii.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/binascii.pyi rename to python/helpers/typeshed/stdlib/binascii.pyi diff --git a/python/helpers/typeshed/stdlib/3/builtins.pyi b/python/helpers/typeshed/stdlib/builtins.pyi similarity index 99% rename from python/helpers/typeshed/stdlib/3/builtins.pyi rename to python/helpers/typeshed/stdlib/builtins.pyi index 20071178134b..ca0779db78c3 100644 --- a/python/helpers/typeshed/stdlib/3/builtins.pyi +++ b/python/helpers/typeshed/stdlib/builtins.pyi @@ -1200,15 +1200,9 @@ def reversed(__sequence: Sequence[_T]) -> Iterator[_T]: ... def reversed(__sequence: Reversible[_T]) -> Iterator[_T]: ... def repr(__obj: object) -> str: ... @overload -def round(number: float) -> int: ... +def round(number: SupportsRound[Any]) -> int: ... @overload -def round(number: float, ndigits: None) -> int: ... -@overload -def round(number: float, ndigits: int) -> float: ... -@overload -def round(number: SupportsRound[_T]) -> int: ... -@overload -def round(number: SupportsRound[_T], ndigits: None) -> int: ... +def round(number: SupportsRound[Any], ndigits: None) -> int: ... @overload def round(number: SupportsRound[_T], ndigits: int) -> _T: ... def setattr(__obj: Any, __name: str, __value: Any) -> None: ... @@ -1298,9 +1292,13 @@ class OSError(Exception): # filename, filename2 are actually Union[str, bytes, None] filename: Any filename2: Any + if sys.platform == "win32": + winerror: int EnvironmentError = OSError IOError = OSError +if sys.platform == "win32": + WindowsError = OSError class ArithmeticError(_StandardError): ... class AssertionError(_StandardError): ... @@ -1340,9 +1338,6 @@ class IndexError(LookupError): ... class KeyError(LookupError): ... class UnboundLocalError(NameError): ... -class WindowsError(OSError): - winerror: int - class BlockingIOError(OSError): characters_written: int diff --git a/python/helpers/typeshed/stdlib/2and3/bz2.pyi b/python/helpers/typeshed/stdlib/bz2.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/bz2.pyi rename to python/helpers/typeshed/stdlib/bz2.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/cProfile.pyi b/python/helpers/typeshed/stdlib/cProfile.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/cProfile.pyi rename to python/helpers/typeshed/stdlib/cProfile.pyi diff --git a/python/helpers/typeshed/stdlib/cgi.pyi b/python/helpers/typeshed/stdlib/cgi.pyi new file mode 100644 index 000000000000..da3a4d43c563 --- /dev/null +++ b/python/helpers/typeshed/stdlib/cgi.pyi @@ -0,0 +1,110 @@ +import sys +from _typeshed import SupportsGetItem, SupportsItemAccess +from builtins import type as _type +from collections.abc import Iterable, Iterator, Mapping +from typing import IO, Any, Optional, Protocol, TypeVar, Union + +_T = TypeVar("_T", bound=FieldStorage) + +def parse( + fp: Optional[IO[Any]] = ..., + environ: SupportsItemAccess[str, str] = ..., + keep_blank_values: bool = ..., + strict_parsing: bool = ..., + separator: str = ..., +) -> dict[str, list[str]]: ... + +if sys.version_info < (3, 8): + def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> dict[str, list[str]]: ... + def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> list[tuple[str, str]]: ... + +if sys.version_info >= (3, 7): + def parse_multipart( + fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = ..., errors: str = ..., separator: str = ... + ) -> dict[str, list[Any]]: ... + +else: + def parse_multipart(fp: IO[Any], pdict: SupportsGetItem[str, bytes]) -> dict[str, list[bytes]]: ... + +class _Environ(Protocol): + def __getitem__(self, __k: str) -> str: ... + def keys(self) -> Iterable[str]: ... + +def parse_header(line: str) -> tuple[str, dict[str, str]]: ... +def test(environ: _Environ = ...) -> None: ... +def print_environ(environ: _Environ = ...) -> None: ... +def print_form(form: dict[str, Any]) -> None: ... +def print_directory() -> None: ... +def print_environ_usage() -> None: ... + +if sys.version_info < (3, 8): + def escape(s: str, quote: Optional[bool] = ...) -> str: ... + +class MiniFieldStorage: + # The first five "Any" attributes here are always None, but mypy doesn't support that + filename: Any + list: Any + type: Any + file: Optional[IO[bytes]] + type_options: dict[Any, Any] + disposition: Any + disposition_options: dict[Any, Any] + headers: dict[Any, Any] + name: Any + value: Any + def __init__(self, name: Any, value: Any) -> None: ... + def __repr__(self) -> str: ... + +_list = list + +class FieldStorage(object): + FieldStorageClass: Optional[_type] + keep_blank_values: int + strict_parsing: int + qs_on_post: Optional[str] + headers: Mapping[str, str] + fp: IO[bytes] + encoding: str + errors: str + outerboundary: bytes + bytes_read: int + limit: Optional[int] + disposition: str + disposition_options: dict[str, str] + filename: Optional[str] + file: Optional[IO[bytes]] + type: str + type_options: dict[str, str] + innerboundary: bytes + length: int + done: int + list: Optional[_list[Any]] + value: Union[None, bytes, _list[Any]] + def __init__( + self, + fp: Optional[IO[Any]] = ..., + headers: Optional[Mapping[str, str]] = ..., + outerboundary: bytes = ..., + environ: SupportsGetItem[str, str] = ..., + keep_blank_values: int = ..., + strict_parsing: int = ..., + limit: Optional[int] = ..., + encoding: str = ..., + errors: str = ..., + max_num_fields: Optional[int] = ..., + separator: str = ..., + ) -> None: ... + def __enter__(self: _T) -> _T: ... + def __exit__(self, *args: Any) -> None: ... + def __repr__(self) -> str: ... + def __iter__(self) -> Iterator[str]: ... + def __getitem__(self, key: str) -> Any: ... + def getvalue(self, key: str, default: Any = ...) -> Any: ... + def getfirst(self, key: str, default: Any = ...) -> Any: ... + def getlist(self, key: str) -> _list[Any]: ... + def keys(self) -> _list[str]: ... + def __contains__(self, key: str) -> bool: ... + def __len__(self) -> int: ... + def __bool__(self) -> bool: ... + # In Python 3 it returns bytes or str IO depending on an internal flag + def make_file(self) -> IO[Any]: ... diff --git a/python/helpers/typeshed/stdlib/2and3/cmath.pyi b/python/helpers/typeshed/stdlib/cmath.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/cmath.pyi rename to python/helpers/typeshed/stdlib/cmath.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/cmd.pyi b/python/helpers/typeshed/stdlib/cmd.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/cmd.pyi rename to python/helpers/typeshed/stdlib/cmd.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/codecs.pyi b/python/helpers/typeshed/stdlib/codecs.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/codecs.pyi rename to python/helpers/typeshed/stdlib/codecs.pyi diff --git a/python/helpers/typeshed/stdlib/3/collections/__init__.pyi b/python/helpers/typeshed/stdlib/collections/__init__.pyi similarity index 96% rename from python/helpers/typeshed/stdlib/3/collections/__init__.pyi rename to python/helpers/typeshed/stdlib/collections/__init__.pyi index a667955db27b..c7633fcdd57a 100644 --- a/python/helpers/typeshed/stdlib/3/collections/__init__.pyi +++ b/python/helpers/typeshed/stdlib/collections/__init__.pyi @@ -1,9 +1,22 @@ import sys -import typing from typing import Any, Dict, Generic, List, Optional, Tuple, Type, TypeVar, Union, overload if sys.version_info < (3, 10): from _collections_abc import * +else: + from typing import ( + Callable, + ItemsView, + Iterable, + Iterator, + KeysView, + Mapping, + MutableMapping, + MutableSequence, + Reversible, + Sequence, + ValuesView, + ) _S = TypeVar("_S") _T = TypeVar("_T") @@ -103,7 +116,7 @@ class UserString(Sequence[str]): def center(self: _UserStringT, width: int, *args: Any) -> _UserStringT: ... def count(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ... if sys.version_info >= (3, 8): - def encode(self: _UserStringT, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> bytes: ... + def encode(self: UserString, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> bytes: ... else: def encode(self: _UserStringT, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UserStringT: ... def endswith(self, suffix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ... @@ -281,9 +294,9 @@ class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ... @property def maps(self) -> List[Mapping[_KT, _VT]]: ... - def new_child(self, m: Mapping[_KT, _VT] = ...) -> typing.ChainMap[_KT, _VT]: ... + def new_child(self, m: Mapping[_KT, _VT] = ...) -> ChainMap[_KT, _VT]: ... @property - def parents(self) -> typing.ChainMap[_KT, _VT]: ... + def parents(self) -> ChainMap[_KT, _VT]: ... def __setitem__(self, k: _KT, v: _VT) -> None: ... def __delitem__(self, v: _KT) -> None: ... def __getitem__(self, k: _KT) -> _VT: ... diff --git a/python/helpers/typeshed/stdlib/3/collections/abc.pyi b/python/helpers/typeshed/stdlib/collections/abc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/collections/abc.pyi rename to python/helpers/typeshed/stdlib/collections/abc.pyi diff --git a/python/helpers/typeshed/stdlib/3/compileall.pyi b/python/helpers/typeshed/stdlib/compileall.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/compileall.pyi rename to python/helpers/typeshed/stdlib/compileall.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/pydoc_data/__init__.pyi b/python/helpers/typeshed/stdlib/concurrent/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/pydoc_data/__init__.pyi rename to python/helpers/typeshed/stdlib/concurrent/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/concurrent/futures/__init__.pyi b/python/helpers/typeshed/stdlib/concurrent/futures/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/concurrent/futures/__init__.pyi rename to python/helpers/typeshed/stdlib/concurrent/futures/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/concurrent/futures/_base.pyi b/python/helpers/typeshed/stdlib/concurrent/futures/_base.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/concurrent/futures/_base.pyi rename to python/helpers/typeshed/stdlib/concurrent/futures/_base.pyi diff --git a/python/helpers/typeshed/stdlib/3/concurrent/futures/process.pyi b/python/helpers/typeshed/stdlib/concurrent/futures/process.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/concurrent/futures/process.pyi rename to python/helpers/typeshed/stdlib/concurrent/futures/process.pyi diff --git a/python/helpers/typeshed/stdlib/3/concurrent/futures/thread.pyi b/python/helpers/typeshed/stdlib/concurrent/futures/thread.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/concurrent/futures/thread.pyi rename to python/helpers/typeshed/stdlib/concurrent/futures/thread.pyi diff --git a/python/helpers/typeshed/stdlib/3/configparser.pyi b/python/helpers/typeshed/stdlib/configparser.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/configparser.pyi rename to python/helpers/typeshed/stdlib/configparser.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/contextlib.pyi b/python/helpers/typeshed/stdlib/contextlib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/contextlib.pyi rename to python/helpers/typeshed/stdlib/contextlib.pyi diff --git a/python/helpers/typeshed/stdlib/3.7/contextvars.pyi b/python/helpers/typeshed/stdlib/contextvars.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3.7/contextvars.pyi rename to python/helpers/typeshed/stdlib/contextvars.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/crypt.pyi b/python/helpers/typeshed/stdlib/crypt.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/crypt.pyi rename to python/helpers/typeshed/stdlib/crypt.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/csv.pyi b/python/helpers/typeshed/stdlib/csv.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/csv.pyi rename to python/helpers/typeshed/stdlib/csv.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/ctypes/__init__.pyi b/python/helpers/typeshed/stdlib/ctypes/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/ctypes/__init__.pyi rename to python/helpers/typeshed/stdlib/ctypes/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/ctypes/util.pyi b/python/helpers/typeshed/stdlib/ctypes/util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/ctypes/util.pyi rename to python/helpers/typeshed/stdlib/ctypes/util.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/ctypes/wintypes.pyi b/python/helpers/typeshed/stdlib/ctypes/wintypes.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/ctypes/wintypes.pyi rename to python/helpers/typeshed/stdlib/ctypes/wintypes.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/curses/__init__.pyi b/python/helpers/typeshed/stdlib/curses/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/curses/__init__.pyi rename to python/helpers/typeshed/stdlib/curses/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/curses/ascii.pyi b/python/helpers/typeshed/stdlib/curses/ascii.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/curses/ascii.pyi rename to python/helpers/typeshed/stdlib/curses/ascii.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/curses/panel.pyi b/python/helpers/typeshed/stdlib/curses/panel.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/curses/panel.pyi rename to python/helpers/typeshed/stdlib/curses/panel.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/curses/textpad.pyi b/python/helpers/typeshed/stdlib/curses/textpad.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/curses/textpad.pyi rename to python/helpers/typeshed/stdlib/curses/textpad.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/datetime.pyi b/python/helpers/typeshed/stdlib/datetime.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/datetime.pyi rename to python/helpers/typeshed/stdlib/datetime.pyi diff --git a/python/helpers/typeshed/stdlib/3/dbm/__init__.pyi b/python/helpers/typeshed/stdlib/dbm/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/dbm/__init__.pyi rename to python/helpers/typeshed/stdlib/dbm/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/dbm/dumb.pyi b/python/helpers/typeshed/stdlib/dbm/dumb.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/dbm/dumb.pyi rename to python/helpers/typeshed/stdlib/dbm/dumb.pyi diff --git a/python/helpers/typeshed/stdlib/3/dbm/gnu.pyi b/python/helpers/typeshed/stdlib/dbm/gnu.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/dbm/gnu.pyi rename to python/helpers/typeshed/stdlib/dbm/gnu.pyi diff --git a/python/helpers/typeshed/stdlib/3/dbm/ndbm.pyi b/python/helpers/typeshed/stdlib/dbm/ndbm.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/dbm/ndbm.pyi rename to python/helpers/typeshed/stdlib/dbm/ndbm.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/decimal.pyi b/python/helpers/typeshed/stdlib/decimal.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/decimal.pyi rename to python/helpers/typeshed/stdlib/decimal.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/difflib.pyi b/python/helpers/typeshed/stdlib/difflib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/difflib.pyi rename to python/helpers/typeshed/stdlib/difflib.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/wsgiref/__init__.pyi b/python/helpers/typeshed/stdlib/distutils/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/wsgiref/__init__.pyi rename to python/helpers/typeshed/stdlib/distutils/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/archive_util.pyi b/python/helpers/typeshed/stdlib/distutils/archive_util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/archive_util.pyi rename to python/helpers/typeshed/stdlib/distutils/archive_util.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/bcppcompiler.pyi b/python/helpers/typeshed/stdlib/distutils/bcppcompiler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/bcppcompiler.pyi rename to python/helpers/typeshed/stdlib/distutils/bcppcompiler.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/ccompiler.pyi b/python/helpers/typeshed/stdlib/distutils/ccompiler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/ccompiler.pyi rename to python/helpers/typeshed/stdlib/distutils/ccompiler.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/cmd.pyi b/python/helpers/typeshed/stdlib/distutils/cmd.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/cmd.pyi rename to python/helpers/typeshed/stdlib/distutils/cmd.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/etree/__init__.pyi b/python/helpers/typeshed/stdlib/distutils/command/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/etree/__init__.pyi rename to python/helpers/typeshed/stdlib/distutils/command/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/bdist.pyi b/python/helpers/typeshed/stdlib/distutils/command/bdist.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/bdist.pyi rename to python/helpers/typeshed/stdlib/distutils/command/bdist.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/bdist_dumb.pyi b/python/helpers/typeshed/stdlib/distutils/command/bdist_dumb.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/bdist_dumb.pyi rename to python/helpers/typeshed/stdlib/distutils/command/bdist_dumb.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/bdist_msi.pyi b/python/helpers/typeshed/stdlib/distutils/command/bdist_msi.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/bdist_msi.pyi rename to python/helpers/typeshed/stdlib/distutils/command/bdist_msi.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/bdist_packager.pyi b/python/helpers/typeshed/stdlib/distutils/command/bdist_packager.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/bdist_packager.pyi rename to python/helpers/typeshed/stdlib/distutils/command/bdist_packager.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/bdist_rpm.pyi b/python/helpers/typeshed/stdlib/distutils/command/bdist_rpm.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/bdist_rpm.pyi rename to python/helpers/typeshed/stdlib/distutils/command/bdist_rpm.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/bdist_wininst.pyi b/python/helpers/typeshed/stdlib/distutils/command/bdist_wininst.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/bdist_wininst.pyi rename to python/helpers/typeshed/stdlib/distutils/command/bdist_wininst.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/build.pyi b/python/helpers/typeshed/stdlib/distutils/command/build.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/build.pyi rename to python/helpers/typeshed/stdlib/distutils/command/build.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/build_clib.pyi b/python/helpers/typeshed/stdlib/distutils/command/build_clib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/build_clib.pyi rename to python/helpers/typeshed/stdlib/distutils/command/build_clib.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/build_ext.pyi b/python/helpers/typeshed/stdlib/distutils/command/build_ext.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/build_ext.pyi rename to python/helpers/typeshed/stdlib/distutils/command/build_ext.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/build_py.pyi b/python/helpers/typeshed/stdlib/distutils/command/build_py.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/build_py.pyi rename to python/helpers/typeshed/stdlib/distutils/command/build_py.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/build_scripts.pyi b/python/helpers/typeshed/stdlib/distutils/command/build_scripts.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/build_scripts.pyi rename to python/helpers/typeshed/stdlib/distutils/command/build_scripts.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/check.pyi b/python/helpers/typeshed/stdlib/distutils/command/check.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/check.pyi rename to python/helpers/typeshed/stdlib/distutils/command/check.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/clean.pyi b/python/helpers/typeshed/stdlib/distutils/command/clean.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/clean.pyi rename to python/helpers/typeshed/stdlib/distutils/command/clean.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/config.pyi b/python/helpers/typeshed/stdlib/distutils/command/config.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/config.pyi rename to python/helpers/typeshed/stdlib/distutils/command/config.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/install.pyi b/python/helpers/typeshed/stdlib/distutils/command/install.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/install.pyi rename to python/helpers/typeshed/stdlib/distutils/command/install.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/install_data.pyi b/python/helpers/typeshed/stdlib/distutils/command/install_data.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/install_data.pyi rename to python/helpers/typeshed/stdlib/distutils/command/install_data.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/install_egg_info.pyi b/python/helpers/typeshed/stdlib/distutils/command/install_egg_info.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/install_egg_info.pyi rename to python/helpers/typeshed/stdlib/distutils/command/install_egg_info.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/install_headers.pyi b/python/helpers/typeshed/stdlib/distutils/command/install_headers.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/install_headers.pyi rename to python/helpers/typeshed/stdlib/distutils/command/install_headers.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/install_lib.pyi b/python/helpers/typeshed/stdlib/distutils/command/install_lib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/install_lib.pyi rename to python/helpers/typeshed/stdlib/distutils/command/install_lib.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/install_scripts.pyi b/python/helpers/typeshed/stdlib/distutils/command/install_scripts.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/install_scripts.pyi rename to python/helpers/typeshed/stdlib/distutils/command/install_scripts.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/register.pyi b/python/helpers/typeshed/stdlib/distutils/command/register.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/register.pyi rename to python/helpers/typeshed/stdlib/distutils/command/register.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/sdist.pyi b/python/helpers/typeshed/stdlib/distutils/command/sdist.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/sdist.pyi rename to python/helpers/typeshed/stdlib/distutils/command/sdist.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/upload.pyi b/python/helpers/typeshed/stdlib/distutils/command/upload.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/upload.pyi rename to python/helpers/typeshed/stdlib/distutils/command/upload.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/config.pyi b/python/helpers/typeshed/stdlib/distutils/config.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/config.pyi rename to python/helpers/typeshed/stdlib/distutils/config.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/core.pyi b/python/helpers/typeshed/stdlib/distutils/core.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/core.pyi rename to python/helpers/typeshed/stdlib/distutils/core.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/cygwinccompiler.pyi b/python/helpers/typeshed/stdlib/distutils/cygwinccompiler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/cygwinccompiler.pyi rename to python/helpers/typeshed/stdlib/distutils/cygwinccompiler.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/debug.pyi b/python/helpers/typeshed/stdlib/distutils/debug.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/debug.pyi rename to python/helpers/typeshed/stdlib/distutils/debug.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/dep_util.pyi b/python/helpers/typeshed/stdlib/distutils/dep_util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/dep_util.pyi rename to python/helpers/typeshed/stdlib/distutils/dep_util.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/dir_util.pyi b/python/helpers/typeshed/stdlib/distutils/dir_util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/dir_util.pyi rename to python/helpers/typeshed/stdlib/distutils/dir_util.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/dist.pyi b/python/helpers/typeshed/stdlib/distutils/dist.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/dist.pyi rename to python/helpers/typeshed/stdlib/distutils/dist.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/errors.pyi b/python/helpers/typeshed/stdlib/distutils/errors.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/errors.pyi rename to python/helpers/typeshed/stdlib/distutils/errors.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/extension.pyi b/python/helpers/typeshed/stdlib/distutils/extension.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/extension.pyi rename to python/helpers/typeshed/stdlib/distutils/extension.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/fancy_getopt.pyi b/python/helpers/typeshed/stdlib/distutils/fancy_getopt.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/fancy_getopt.pyi rename to python/helpers/typeshed/stdlib/distutils/fancy_getopt.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/file_util.pyi b/python/helpers/typeshed/stdlib/distutils/file_util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/file_util.pyi rename to python/helpers/typeshed/stdlib/distutils/file_util.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/filelist.pyi b/python/helpers/typeshed/stdlib/distutils/filelist.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/filelist.pyi rename to python/helpers/typeshed/stdlib/distutils/filelist.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/log.pyi b/python/helpers/typeshed/stdlib/distutils/log.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/log.pyi rename to python/helpers/typeshed/stdlib/distutils/log.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/msvccompiler.pyi b/python/helpers/typeshed/stdlib/distutils/msvccompiler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/msvccompiler.pyi rename to python/helpers/typeshed/stdlib/distutils/msvccompiler.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/spawn.pyi b/python/helpers/typeshed/stdlib/distutils/spawn.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/spawn.pyi rename to python/helpers/typeshed/stdlib/distutils/spawn.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/sysconfig.pyi b/python/helpers/typeshed/stdlib/distutils/sysconfig.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/sysconfig.pyi rename to python/helpers/typeshed/stdlib/distutils/sysconfig.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/text_file.pyi b/python/helpers/typeshed/stdlib/distutils/text_file.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/text_file.pyi rename to python/helpers/typeshed/stdlib/distutils/text_file.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/unixccompiler.pyi b/python/helpers/typeshed/stdlib/distutils/unixccompiler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/unixccompiler.pyi rename to python/helpers/typeshed/stdlib/distutils/unixccompiler.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/util.pyi b/python/helpers/typeshed/stdlib/distutils/util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/util.pyi rename to python/helpers/typeshed/stdlib/distutils/util.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/version.pyi b/python/helpers/typeshed/stdlib/distutils/version.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/version.pyi rename to python/helpers/typeshed/stdlib/distutils/version.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/doctest.pyi b/python/helpers/typeshed/stdlib/doctest.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/doctest.pyi rename to python/helpers/typeshed/stdlib/doctest.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/__init__.pyi b/python/helpers/typeshed/stdlib/email/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/__init__.pyi rename to python/helpers/typeshed/stdlib/email/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/charset.pyi b/python/helpers/typeshed/stdlib/email/charset.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/charset.pyi rename to python/helpers/typeshed/stdlib/email/charset.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/contentmanager.pyi b/python/helpers/typeshed/stdlib/email/contentmanager.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/contentmanager.pyi rename to python/helpers/typeshed/stdlib/email/contentmanager.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/encoders.pyi b/python/helpers/typeshed/stdlib/email/encoders.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/encoders.pyi rename to python/helpers/typeshed/stdlib/email/encoders.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/errors.pyi b/python/helpers/typeshed/stdlib/email/errors.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/errors.pyi rename to python/helpers/typeshed/stdlib/email/errors.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/feedparser.pyi b/python/helpers/typeshed/stdlib/email/feedparser.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/feedparser.pyi rename to python/helpers/typeshed/stdlib/email/feedparser.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/generator.pyi b/python/helpers/typeshed/stdlib/email/generator.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/generator.pyi rename to python/helpers/typeshed/stdlib/email/generator.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/header.pyi b/python/helpers/typeshed/stdlib/email/header.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/header.pyi rename to python/helpers/typeshed/stdlib/email/header.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/headerregistry.pyi b/python/helpers/typeshed/stdlib/email/headerregistry.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/headerregistry.pyi rename to python/helpers/typeshed/stdlib/email/headerregistry.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/iterators.pyi b/python/helpers/typeshed/stdlib/email/iterators.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/iterators.pyi rename to python/helpers/typeshed/stdlib/email/iterators.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/message.pyi b/python/helpers/typeshed/stdlib/email/message.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/message.pyi rename to python/helpers/typeshed/stdlib/email/message.pyi diff --git a/python/helpers/typeshed/stdlib/3/concurrent/__init__.pyi b/python/helpers/typeshed/stdlib/email/mime/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/concurrent/__init__.pyi rename to python/helpers/typeshed/stdlib/email/mime/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/mime/application.pyi b/python/helpers/typeshed/stdlib/email/mime/application.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/mime/application.pyi rename to python/helpers/typeshed/stdlib/email/mime/application.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/mime/audio.pyi b/python/helpers/typeshed/stdlib/email/mime/audio.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/mime/audio.pyi rename to python/helpers/typeshed/stdlib/email/mime/audio.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/mime/base.pyi b/python/helpers/typeshed/stdlib/email/mime/base.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/mime/base.pyi rename to python/helpers/typeshed/stdlib/email/mime/base.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/mime/image.pyi b/python/helpers/typeshed/stdlib/email/mime/image.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/mime/image.pyi rename to python/helpers/typeshed/stdlib/email/mime/image.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/mime/message.pyi b/python/helpers/typeshed/stdlib/email/mime/message.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/mime/message.pyi rename to python/helpers/typeshed/stdlib/email/mime/message.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/mime/multipart.pyi b/python/helpers/typeshed/stdlib/email/mime/multipart.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/mime/multipart.pyi rename to python/helpers/typeshed/stdlib/email/mime/multipart.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/mime/nonmultipart.pyi b/python/helpers/typeshed/stdlib/email/mime/nonmultipart.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/mime/nonmultipart.pyi rename to python/helpers/typeshed/stdlib/email/mime/nonmultipart.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/mime/text.pyi b/python/helpers/typeshed/stdlib/email/mime/text.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/mime/text.pyi rename to python/helpers/typeshed/stdlib/email/mime/text.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/parser.pyi b/python/helpers/typeshed/stdlib/email/parser.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/parser.pyi rename to python/helpers/typeshed/stdlib/email/parser.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/policy.pyi b/python/helpers/typeshed/stdlib/email/policy.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/policy.pyi rename to python/helpers/typeshed/stdlib/email/policy.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/utils.pyi b/python/helpers/typeshed/stdlib/email/utils.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/utils.pyi rename to python/helpers/typeshed/stdlib/email/utils.pyi diff --git a/python/helpers/typeshed/stdlib/3/faulthandler.pyi b/python/helpers/typeshed/stdlib/faulthandler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/faulthandler.pyi rename to python/helpers/typeshed/stdlib/faulthandler.pyi diff --git a/python/helpers/typeshed/stdlib/3/fcntl.pyi b/python/helpers/typeshed/stdlib/fcntl.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/fcntl.pyi rename to python/helpers/typeshed/stdlib/fcntl.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/filecmp.pyi b/python/helpers/typeshed/stdlib/filecmp.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/filecmp.pyi rename to python/helpers/typeshed/stdlib/filecmp.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/fractions.pyi b/python/helpers/typeshed/stdlib/fractions.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/fractions.pyi rename to python/helpers/typeshed/stdlib/fractions.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/ftplib.pyi b/python/helpers/typeshed/stdlib/ftplib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/ftplib.pyi rename to python/helpers/typeshed/stdlib/ftplib.pyi diff --git a/python/helpers/typeshed/stdlib/3/functools.pyi b/python/helpers/typeshed/stdlib/functools.pyi similarity index 89% rename from python/helpers/typeshed/stdlib/3/functools.pyi rename to python/helpers/typeshed/stdlib/functools.pyi index 10c46f42ea79..32c65937b1e3 100644 --- a/python/helpers/typeshed/stdlib/3/functools.pyi +++ b/python/helpers/typeshed/stdlib/functools.pyi @@ -91,14 +91,14 @@ class _SingleDispatchCallable(Generic[_T]): # @fun.register(complex) # def _(arg, verbose=False): ... @overload - def register(self, cls: type, func: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... + def register(self, cls: Type[Any], func: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... # @fun.register # def _(arg: int, verbose=False): @overload def register(self, cls: Callable[..., _T], func: None = ...) -> Callable[..., _T]: ... # fun.register(int, lambda x: x) @overload - def register(self, cls: Type, func: Callable[..., _T]) -> Callable[..., _T]: ... + def register(self, cls: Type[Any], func: Callable[..., _T]) -> Callable[..., _T]: ... def _clear_cache(self) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> _T: ... @@ -110,11 +110,11 @@ if sys.version_info >= (3, 8): func: Callable[..., _T] def __init__(self, func: Callable[..., _T]) -> None: ... @overload - def register(self, cls: Type, method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... + def register(self, cls: Type[Any], method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... @overload def register(self, cls: Callable[..., _T], method: None = ...) -> Callable[..., _T]: ... @overload - def register(self, cls: Type, method: Callable[..., _T]) -> Callable[..., _T]: ... + def register(self, cls: Type[Any], method: Callable[..., _T]) -> Callable[..., _T]: ... def __call__(self, *args: Any, **kwargs: Any) -> _T: ... class cached_property(Generic[_T]): func: Callable[[Any], _T] @@ -123,7 +123,7 @@ if sys.version_info >= (3, 8): @overload def __get__(self, instance: None, owner: Optional[Type[Any]] = ...) -> cached_property[_T]: ... @overload - def __get__(self, instance: _S, owner: Optional[Type[Any]] = ...) -> _T: ... + def __get__(self, instance: object, owner: Optional[Type[Any]] = ...) -> _T: ... def __set_name__(self, owner: Type[Any], name: str) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... diff --git a/python/helpers/typeshed/stdlib/3/gc.pyi b/python/helpers/typeshed/stdlib/gc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/gc.pyi rename to python/helpers/typeshed/stdlib/gc.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/genericpath.pyi b/python/helpers/typeshed/stdlib/genericpath.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/genericpath.pyi rename to python/helpers/typeshed/stdlib/genericpath.pyi diff --git a/python/helpers/typeshed/stdlib/3/gettext.pyi b/python/helpers/typeshed/stdlib/gettext.pyi similarity index 99% rename from python/helpers/typeshed/stdlib/3/gettext.pyi rename to python/helpers/typeshed/stdlib/gettext.pyi index 5624817b1435..74a5e56a74c6 100644 --- a/python/helpers/typeshed/stdlib/3/gettext.pyi +++ b/python/helpers/typeshed/stdlib/gettext.pyi @@ -52,7 +52,7 @@ def translation( domain: str, localedir: Optional[StrPath] = ..., languages: Optional[Iterable[str]] = ..., - class_: Type[_T] = ..., + class_: Type[Any] = ..., fallback: Literal[True] = ..., codeset: Optional[str] = ..., ) -> Any: ... diff --git a/python/helpers/typeshed/stdlib/3.9/graphlib.pyi b/python/helpers/typeshed/stdlib/graphlib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3.9/graphlib.pyi rename to python/helpers/typeshed/stdlib/graphlib.pyi diff --git a/python/helpers/typeshed/stdlib/3/hashlib.pyi b/python/helpers/typeshed/stdlib/hashlib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/hashlib.pyi rename to python/helpers/typeshed/stdlib/hashlib.pyi diff --git a/python/helpers/typeshed/stdlib/3/heapq.pyi b/python/helpers/typeshed/stdlib/heapq.pyi similarity index 86% rename from python/helpers/typeshed/stdlib/3/heapq.pyi rename to python/helpers/typeshed/stdlib/heapq.pyi index 5592e615fcd2..3d27a30bb412 100644 --- a/python/helpers/typeshed/stdlib/3/heapq.pyi +++ b/python/helpers/typeshed/stdlib/heapq.pyi @@ -6,9 +6,9 @@ _T = TypeVar("_T") def heappush(__heap: List[_T], __item: _T) -> None: ... def heappop(__heap: List[_T]) -> _T: ... def heappushpop(__heap: List[_T], __item: _T) -> _T: ... -def heapify(__heap: List[_T]) -> None: ... +def heapify(__heap: List[Any]) -> None: ... def heapreplace(__heap: List[_T], __item: _T) -> _T: ... def merge(*iterables: Iterable[_T], key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...) -> 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 _heapify_max(__x: List[Any]) -> None: ... # undocumented diff --git a/python/helpers/typeshed/stdlib/2and3/hmac.pyi b/python/helpers/typeshed/stdlib/hmac.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/hmac.pyi rename to python/helpers/typeshed/stdlib/hmac.pyi diff --git a/python/helpers/typeshed/stdlib/3/http/__init__.pyi b/python/helpers/typeshed/stdlib/http/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/http/__init__.pyi rename to python/helpers/typeshed/stdlib/http/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/http/client.pyi b/python/helpers/typeshed/stdlib/http/client.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/http/client.pyi rename to python/helpers/typeshed/stdlib/http/client.pyi diff --git a/python/helpers/typeshed/stdlib/3/http/cookiejar.pyi b/python/helpers/typeshed/stdlib/http/cookiejar.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/http/cookiejar.pyi rename to python/helpers/typeshed/stdlib/http/cookiejar.pyi diff --git a/python/helpers/typeshed/stdlib/3/http/cookies.pyi b/python/helpers/typeshed/stdlib/http/cookies.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/http/cookies.pyi rename to python/helpers/typeshed/stdlib/http/cookies.pyi diff --git a/python/helpers/typeshed/stdlib/3/http/server.pyi b/python/helpers/typeshed/stdlib/http/server.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/http/server.pyi rename to python/helpers/typeshed/stdlib/http/server.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/imaplib.pyi b/python/helpers/typeshed/stdlib/imaplib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/imaplib.pyi rename to python/helpers/typeshed/stdlib/imaplib.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/imghdr.pyi b/python/helpers/typeshed/stdlib/imghdr.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/imghdr.pyi rename to python/helpers/typeshed/stdlib/imghdr.pyi diff --git a/python/helpers/typeshed/stdlib/3/importlib/__init__.pyi b/python/helpers/typeshed/stdlib/importlib/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/importlib/__init__.pyi rename to python/helpers/typeshed/stdlib/importlib/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/importlib/abc.pyi b/python/helpers/typeshed/stdlib/importlib/abc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/importlib/abc.pyi rename to python/helpers/typeshed/stdlib/importlib/abc.pyi diff --git a/python/helpers/typeshed/stdlib/3/importlib/machinery.pyi b/python/helpers/typeshed/stdlib/importlib/machinery.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/importlib/machinery.pyi rename to python/helpers/typeshed/stdlib/importlib/machinery.pyi diff --git a/python/helpers/typeshed/stdlib/3/importlib/metadata.pyi b/python/helpers/typeshed/stdlib/importlib/metadata.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/importlib/metadata.pyi rename to python/helpers/typeshed/stdlib/importlib/metadata.pyi diff --git a/python/helpers/typeshed/stdlib/3/importlib/resources.pyi b/python/helpers/typeshed/stdlib/importlib/resources.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/importlib/resources.pyi rename to python/helpers/typeshed/stdlib/importlib/resources.pyi diff --git a/python/helpers/typeshed/stdlib/3/importlib/util.pyi b/python/helpers/typeshed/stdlib/importlib/util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/importlib/util.pyi rename to python/helpers/typeshed/stdlib/importlib/util.pyi diff --git a/python/helpers/typeshed/stdlib/3/inspect.pyi b/python/helpers/typeshed/stdlib/inspect.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/inspect.pyi rename to python/helpers/typeshed/stdlib/inspect.pyi diff --git a/python/helpers/typeshed/stdlib/3/io.pyi b/python/helpers/typeshed/stdlib/io.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/io.pyi rename to python/helpers/typeshed/stdlib/io.pyi diff --git a/python/helpers/typeshed/stdlib/3/ipaddress.pyi b/python/helpers/typeshed/stdlib/ipaddress.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/ipaddress.pyi rename to python/helpers/typeshed/stdlib/ipaddress.pyi diff --git a/python/helpers/typeshed/stdlib/3/itertools.pyi b/python/helpers/typeshed/stdlib/itertools.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/itertools.pyi rename to python/helpers/typeshed/stdlib/itertools.pyi diff --git a/python/helpers/typeshed/stdlib/3/json/__init__.pyi b/python/helpers/typeshed/stdlib/json/__init__.pyi similarity index 97% rename from python/helpers/typeshed/stdlib/3/json/__init__.pyi rename to python/helpers/typeshed/stdlib/json/__init__.pyi index 69c82a9c6cd1..7b7a89ae20e2 100644 --- a/python/helpers/typeshed/stdlib/3/json/__init__.pyi +++ b/python/helpers/typeshed/stdlib/json/__init__.pyi @@ -55,3 +55,4 @@ def load( object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ..., **kwds: Any, ) -> Any: ... +def detect_encoding(b: bytes) -> str: ... # undocumented diff --git a/python/helpers/typeshed/stdlib/3/json/decoder.pyi b/python/helpers/typeshed/stdlib/json/decoder.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/json/decoder.pyi rename to python/helpers/typeshed/stdlib/json/decoder.pyi diff --git a/python/helpers/typeshed/stdlib/3/json/encoder.pyi b/python/helpers/typeshed/stdlib/json/encoder.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/json/encoder.pyi rename to python/helpers/typeshed/stdlib/json/encoder.pyi diff --git a/python/helpers/typeshed/stdlib/3/json/tool.pyi b/python/helpers/typeshed/stdlib/json/tool.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/json/tool.pyi rename to python/helpers/typeshed/stdlib/json/tool.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/keyword.pyi b/python/helpers/typeshed/stdlib/keyword.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/keyword.pyi rename to python/helpers/typeshed/stdlib/keyword.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/locale.pyi b/python/helpers/typeshed/stdlib/locale.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/locale.pyi rename to python/helpers/typeshed/stdlib/locale.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/logging/__init__.pyi b/python/helpers/typeshed/stdlib/logging/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/logging/__init__.pyi rename to python/helpers/typeshed/stdlib/logging/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/logging/config.pyi b/python/helpers/typeshed/stdlib/logging/config.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/logging/config.pyi rename to python/helpers/typeshed/stdlib/logging/config.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/logging/handlers.pyi b/python/helpers/typeshed/stdlib/logging/handlers.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/logging/handlers.pyi rename to python/helpers/typeshed/stdlib/logging/handlers.pyi diff --git a/python/helpers/typeshed/stdlib/3/lzma.pyi b/python/helpers/typeshed/stdlib/lzma.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/lzma.pyi rename to python/helpers/typeshed/stdlib/lzma.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/macpath.pyi b/python/helpers/typeshed/stdlib/macpath.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/macpath.pyi rename to python/helpers/typeshed/stdlib/macpath.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/marshal.pyi b/python/helpers/typeshed/stdlib/marshal.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/marshal.pyi rename to python/helpers/typeshed/stdlib/marshal.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/math.pyi b/python/helpers/typeshed/stdlib/math.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/math.pyi rename to python/helpers/typeshed/stdlib/math.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/mimetypes.pyi b/python/helpers/typeshed/stdlib/mimetypes.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/mimetypes.pyi rename to python/helpers/typeshed/stdlib/mimetypes.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/mmap.pyi b/python/helpers/typeshed/stdlib/mmap.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/mmap.pyi rename to python/helpers/typeshed/stdlib/mmap.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/modulefinder.pyi b/python/helpers/typeshed/stdlib/modulefinder.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/modulefinder.pyi rename to python/helpers/typeshed/stdlib/modulefinder.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/msilib/__init__.pyi b/python/helpers/typeshed/stdlib/msilib/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/msilib/__init__.pyi rename to python/helpers/typeshed/stdlib/msilib/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/msilib/schema.pyi b/python/helpers/typeshed/stdlib/msilib/schema.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/msilib/schema.pyi rename to python/helpers/typeshed/stdlib/msilib/schema.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/msilib/sequence.pyi b/python/helpers/typeshed/stdlib/msilib/sequence.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/msilib/sequence.pyi rename to python/helpers/typeshed/stdlib/msilib/sequence.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/msilib/text.pyi b/python/helpers/typeshed/stdlib/msilib/text.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/msilib/text.pyi rename to python/helpers/typeshed/stdlib/msilib/text.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/__init__.pyi b/python/helpers/typeshed/stdlib/multiprocessing/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/__init__.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/connection.pyi b/python/helpers/typeshed/stdlib/multiprocessing/connection.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/connection.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/connection.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/context.pyi b/python/helpers/typeshed/stdlib/multiprocessing/context.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/context.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/context.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/dummy/__init__.pyi b/python/helpers/typeshed/stdlib/multiprocessing/dummy/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/dummy/__init__.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/dummy/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/dummy/connection.pyi b/python/helpers/typeshed/stdlib/multiprocessing/dummy/connection.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/dummy/connection.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/dummy/connection.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/managers.pyi b/python/helpers/typeshed/stdlib/multiprocessing/managers.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/managers.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/managers.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/pool.pyi b/python/helpers/typeshed/stdlib/multiprocessing/pool.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/pool.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/pool.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/process.pyi b/python/helpers/typeshed/stdlib/multiprocessing/process.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/process.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/process.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/queues.pyi b/python/helpers/typeshed/stdlib/multiprocessing/queues.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/queues.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/queues.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/shared_memory.pyi b/python/helpers/typeshed/stdlib/multiprocessing/shared_memory.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/shared_memory.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/shared_memory.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/sharedctypes.pyi b/python/helpers/typeshed/stdlib/multiprocessing/sharedctypes.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/sharedctypes.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/sharedctypes.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/spawn.pyi b/python/helpers/typeshed/stdlib/multiprocessing/spawn.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/spawn.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/spawn.pyi diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/synchronize.pyi b/python/helpers/typeshed/stdlib/multiprocessing/synchronize.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/multiprocessing/synchronize.pyi rename to python/helpers/typeshed/stdlib/multiprocessing/synchronize.pyi diff --git a/python/helpers/typeshed/stdlib/3/ntpath.pyi b/python/helpers/typeshed/stdlib/ntpath.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/ntpath.pyi rename to python/helpers/typeshed/stdlib/ntpath.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/numbers.pyi b/python/helpers/typeshed/stdlib/numbers.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/numbers.pyi rename to python/helpers/typeshed/stdlib/numbers.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/opcode.pyi b/python/helpers/typeshed/stdlib/opcode.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/opcode.pyi rename to python/helpers/typeshed/stdlib/opcode.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/operator.pyi b/python/helpers/typeshed/stdlib/operator.pyi similarity index 94% rename from python/helpers/typeshed/stdlib/2and3/operator.pyi rename to python/helpers/typeshed/stdlib/operator.pyi index f82d4c6671f5..687de813e758 100644 --- a/python/helpers/typeshed/stdlib/2and3/operator.pyi +++ b/python/helpers/typeshed/stdlib/operator.pyi @@ -86,17 +86,17 @@ def contains(__a: Container[Any], __b: Any) -> bool: ... def __contains__(a: Container[Any], b: Any) -> bool: ... def countOf(__a: Container[Any], __b: Any) -> int: ... @overload -def delitem(__a: MutableSequence[_T], __b: int) -> None: ... +def delitem(__a: MutableSequence[Any], __b: int) -> None: ... @overload -def delitem(__a: MutableSequence[_T], __b: slice) -> None: ... +def delitem(__a: MutableSequence[Any], __b: slice) -> None: ... @overload -def delitem(__a: MutableMapping[_K, _V], __b: _K) -> None: ... +def delitem(__a: MutableMapping[_K, Any], __b: _K) -> None: ... @overload -def __delitem__(a: MutableSequence[_T], b: int) -> None: ... +def __delitem__(a: MutableSequence[Any], b: int) -> None: ... @overload -def __delitem__(a: MutableSequence[_T], b: slice) -> None: ... +def __delitem__(a: MutableSequence[Any], b: slice) -> None: ... @overload -def __delitem__(a: MutableMapping[_K, _V], b: _K) -> None: ... +def __delitem__(a: MutableMapping[_K, Any], b: _K) -> None: ... if sys.version_info < (3,): def delslice(a: MutableSequence[Any], b: int, c: int) -> None: ... diff --git a/python/helpers/typeshed/stdlib/3/os/__init__.pyi b/python/helpers/typeshed/stdlib/os/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/os/__init__.pyi rename to python/helpers/typeshed/stdlib/os/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/os/path.pyi b/python/helpers/typeshed/stdlib/os/path.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/os/path.pyi rename to python/helpers/typeshed/stdlib/os/path.pyi diff --git a/python/helpers/typeshed/stdlib/3/ossaudiodev.pyi b/python/helpers/typeshed/stdlib/ossaudiodev.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/ossaudiodev.pyi rename to python/helpers/typeshed/stdlib/ossaudiodev.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/parser.pyi b/python/helpers/typeshed/stdlib/parser.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/parser.pyi rename to python/helpers/typeshed/stdlib/parser.pyi diff --git a/python/helpers/typeshed/stdlib/3/pathlib.pyi b/python/helpers/typeshed/stdlib/pathlib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/pathlib.pyi rename to python/helpers/typeshed/stdlib/pathlib.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/pdb.pyi b/python/helpers/typeshed/stdlib/pdb.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/pdb.pyi rename to python/helpers/typeshed/stdlib/pdb.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/pickle.pyi b/python/helpers/typeshed/stdlib/pickle.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/pickle.pyi rename to python/helpers/typeshed/stdlib/pickle.pyi diff --git a/python/helpers/typeshed/stdlib/3/pipes.pyi b/python/helpers/typeshed/stdlib/pipes.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/pipes.pyi rename to python/helpers/typeshed/stdlib/pipes.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/pkgutil.pyi b/python/helpers/typeshed/stdlib/pkgutil.pyi similarity index 95% rename from python/helpers/typeshed/stdlib/2and3/pkgutil.pyi rename to python/helpers/typeshed/stdlib/pkgutil.pyi index 5fd025411325..ae042b73de60 100644 --- a/python/helpers/typeshed/stdlib/2and3/pkgutil.pyi +++ b/python/helpers/typeshed/stdlib/pkgutil.pyi @@ -36,3 +36,6 @@ def walk_packages( path: Optional[Iterable[str]] = ..., prefix: str = ..., onerror: Optional[Callable[[str], None]] = ... ) -> Iterator[_ModuleInfoLike]: ... def get_data(package: str, resource: str) -> Optional[bytes]: ... + +if sys.version_info >= (3, 9): + def resolve_name(name: str) -> Any: ... diff --git a/python/helpers/typeshed/stdlib/2and3/plistlib.pyi b/python/helpers/typeshed/stdlib/plistlib.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/plistlib.pyi rename to python/helpers/typeshed/stdlib/plistlib.pyi diff --git a/python/helpers/typeshed/stdlib/3/posix.pyi b/python/helpers/typeshed/stdlib/posix.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/posix.pyi rename to python/helpers/typeshed/stdlib/posix.pyi diff --git a/python/helpers/typeshed/stdlib/3/posixpath.pyi b/python/helpers/typeshed/stdlib/posixpath.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/posixpath.pyi rename to python/helpers/typeshed/stdlib/posixpath.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/pprint.pyi b/python/helpers/typeshed/stdlib/pprint.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/pprint.pyi rename to python/helpers/typeshed/stdlib/pprint.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/pstats.pyi b/python/helpers/typeshed/stdlib/pstats.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/pstats.pyi rename to python/helpers/typeshed/stdlib/pstats.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/py_compile.pyi b/python/helpers/typeshed/stdlib/py_compile.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/py_compile.pyi rename to python/helpers/typeshed/stdlib/py_compile.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/pydoc.pyi b/python/helpers/typeshed/stdlib/pydoc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/pydoc.pyi rename to python/helpers/typeshed/stdlib/pydoc.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/__init__.pyi b/python/helpers/typeshed/stdlib/pydoc_data/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/__init__.pyi rename to python/helpers/typeshed/stdlib/pydoc_data/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/pydoc_data/topics.pyi b/python/helpers/typeshed/stdlib/pydoc_data/topics.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/pydoc_data/topics.pyi rename to python/helpers/typeshed/stdlib/pydoc_data/topics.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/pyexpat/__init__.pyi b/python/helpers/typeshed/stdlib/pyexpat/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/pyexpat/__init__.pyi rename to python/helpers/typeshed/stdlib/pyexpat/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/pyexpat/errors.pyi b/python/helpers/typeshed/stdlib/pyexpat/errors.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/pyexpat/errors.pyi rename to python/helpers/typeshed/stdlib/pyexpat/errors.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/pyexpat/model.pyi b/python/helpers/typeshed/stdlib/pyexpat/model.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/pyexpat/model.pyi rename to python/helpers/typeshed/stdlib/pyexpat/model.pyi diff --git a/python/helpers/typeshed/stdlib/3/queue.pyi b/python/helpers/typeshed/stdlib/queue.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/queue.pyi rename to python/helpers/typeshed/stdlib/queue.pyi diff --git a/python/helpers/typeshed/stdlib/3/random.pyi b/python/helpers/typeshed/stdlib/random.pyi similarity index 83% rename from python/helpers/typeshed/stdlib/3/random.pyi rename to python/helpers/typeshed/stdlib/random.pyi index 9a28024c2c39..f749154c626f 100644 --- a/python/helpers/typeshed/stdlib/3/random.pyi +++ b/python/helpers/typeshed/stdlib/random.pyi @@ -1,6 +1,7 @@ import _random import sys -from typing import AbstractSet, Any, Callable, Iterable, List, MutableSequence, Optional, Sequence, Tuple, TypeVar, Union +from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set +from typing import Any, Optional, Tuple, TypeVar, Union _T = TypeVar("_T") @@ -22,14 +23,14 @@ class Random(_random.Random): *, cum_weights: Optional[Sequence[float]] = ..., k: int = ..., - ) -> List[_T]: ... + ) -> list[_T]: ... def shuffle(self, x: MutableSequence[Any], random: Optional[Callable[[], float]] = ...) -> None: ... if sys.version_info >= (3, 9): def sample( - self, population: Union[Sequence[_T], AbstractSet[_T]], k: int, *, counts: Optional[Iterable[_T]] = ... - ) -> List[_T]: ... + self, population: Union[Sequence[_T], Set[_T]], k: int, *, counts: Optional[Iterable[_T]] = ... + ) -> list[_T]: ... else: - def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ... + def sample(self, population: Union[Sequence[_T], Set[_T]], k: int) -> list[_T]: ... def random(self) -> float: ... def uniform(self, a: float, b: float) -> float: ... def triangular(self, low: float = ..., high: float = ..., mode: Optional[float] = ...) -> float: ... @@ -64,14 +65,14 @@ def choices( *, cum_weights: Optional[Sequence[float]] = ..., k: int = ..., -) -> List[_T]: ... +) -> list[_T]: ... def shuffle(x: MutableSequence[Any], random: Optional[Callable[[], float]] = ...) -> None: ... if sys.version_info >= (3, 9): - def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int, *, counts: Optional[Iterable[_T]] = ...) -> List[_T]: ... + def sample(population: Union[Sequence[_T], Set[_T]], k: int, *, counts: Optional[Iterable[_T]] = ...) -> list[_T]: ... else: - def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ... + def sample(population: Union[Sequence[_T], Set[_T]], k: int) -> list[_T]: ... def random() -> float: ... def uniform(a: float, b: float) -> float: ... diff --git a/python/helpers/typeshed/stdlib/3/re.pyi b/python/helpers/typeshed/stdlib/re.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/re.pyi rename to python/helpers/typeshed/stdlib/re.pyi diff --git a/python/helpers/typeshed/stdlib/3/resource.pyi b/python/helpers/typeshed/stdlib/resource.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/resource.pyi rename to python/helpers/typeshed/stdlib/resource.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/select.pyi b/python/helpers/typeshed/stdlib/select.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/select.pyi rename to python/helpers/typeshed/stdlib/select.pyi diff --git a/python/helpers/typeshed/stdlib/3/selectors.pyi b/python/helpers/typeshed/stdlib/selectors.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/selectors.pyi rename to python/helpers/typeshed/stdlib/selectors.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/shutil.pyi b/python/helpers/typeshed/stdlib/shutil.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/shutil.pyi rename to python/helpers/typeshed/stdlib/shutil.pyi diff --git a/python/helpers/typeshed/stdlib/3/signal.pyi b/python/helpers/typeshed/stdlib/signal.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/signal.pyi rename to python/helpers/typeshed/stdlib/signal.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/socket.pyi b/python/helpers/typeshed/stdlib/socket.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/socket.pyi rename to python/helpers/typeshed/stdlib/socket.pyi diff --git a/python/helpers/typeshed/stdlib/3/socketserver.pyi b/python/helpers/typeshed/stdlib/socketserver.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/socketserver.pyi rename to python/helpers/typeshed/stdlib/socketserver.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/sqlite3/__init__.pyi b/python/helpers/typeshed/stdlib/sqlite3/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/sqlite3/__init__.pyi rename to python/helpers/typeshed/stdlib/sqlite3/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/sqlite3/dbapi2.pyi b/python/helpers/typeshed/stdlib/sqlite3/dbapi2.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/sqlite3/dbapi2.pyi rename to python/helpers/typeshed/stdlib/sqlite3/dbapi2.pyi diff --git a/python/helpers/typeshed/stdlib/3/sre_constants.pyi b/python/helpers/typeshed/stdlib/sre_constants.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/sre_constants.pyi rename to python/helpers/typeshed/stdlib/sre_constants.pyi diff --git a/python/helpers/typeshed/stdlib/3/sre_parse.pyi b/python/helpers/typeshed/stdlib/sre_parse.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/sre_parse.pyi rename to python/helpers/typeshed/stdlib/sre_parse.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/ssl.pyi b/python/helpers/typeshed/stdlib/ssl.pyi similarity index 99% rename from python/helpers/typeshed/stdlib/2and3/ssl.pyi rename to python/helpers/typeshed/stdlib/ssl.pyi index 36656f5534ab..4b9eec42c262 100644 --- a/python/helpers/typeshed/stdlib/2and3/ssl.pyi +++ b/python/helpers/typeshed/stdlib/ssl.pyi @@ -138,6 +138,7 @@ if sys.version_info >= (3, 6): OP_NO_TLSv1: int OP_NO_TLSv1_1: int OP_NO_TLSv1_2: int + OP_NO_TLSv1_3: int OP_CIPHER_SERVER_PREFERENCE: int OP_SINGLE_DH_USE: int OP_SINGLE_ECDH_USE: int @@ -145,7 +146,6 @@ if sys.version_info >= (3, 6): OP_NO_TICKET: int if sys.version_info >= (3, 7): OP_NO_RENEGOTIATION: int - OP_NO_TLSv1_3: int if sys.version_info >= (3, 8): OP_ENABLE_MIDDLEBOX_COMPAT: int OP_ALL: Options @@ -154,6 +154,7 @@ if sys.version_info >= (3, 6): OP_NO_TLSv1: Options OP_NO_TLSv1_1: Options OP_NO_TLSv1_2: Options + OP_NO_TLSv1_3: Options OP_CIPHER_SERVER_PREFERENCE: Options OP_SINGLE_DH_USE: Options OP_SINGLE_ECDH_USE: Options @@ -161,7 +162,6 @@ if sys.version_info >= (3, 6): OP_NO_TICKET: Options if sys.version_info >= (3, 7): OP_NO_RENEGOTIATION: Options - OP_NO_TLSv1_3: Options if sys.version_info >= (3, 8): OP_ENABLE_MIDDLEBOX_COMPAT: Options else: diff --git a/python/helpers/typeshed/stdlib/3/statistics.pyi b/python/helpers/typeshed/stdlib/statistics.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/statistics.pyi rename to python/helpers/typeshed/stdlib/statistics.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/struct.pyi b/python/helpers/typeshed/stdlib/struct.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/struct.pyi rename to python/helpers/typeshed/stdlib/struct.pyi diff --git a/python/helpers/typeshed/stdlib/3/subprocess.pyi b/python/helpers/typeshed/stdlib/subprocess.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/subprocess.pyi rename to python/helpers/typeshed/stdlib/subprocess.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/sunau.pyi b/python/helpers/typeshed/stdlib/sunau.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/sunau.pyi rename to python/helpers/typeshed/stdlib/sunau.pyi diff --git a/python/helpers/typeshed/stdlib/3/sys.pyi b/python/helpers/typeshed/stdlib/sys.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/sys.pyi rename to python/helpers/typeshed/stdlib/sys.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/tarfile.pyi b/python/helpers/typeshed/stdlib/tarfile.pyi similarity index 70% rename from python/helpers/typeshed/stdlib/2and3/tarfile.pyi rename to python/helpers/typeshed/stdlib/tarfile.pyi index 12e80480cc17..b1e72a752056 100644 --- a/python/helpers/typeshed/stdlib/2and3/tarfile.pyi +++ b/python/helpers/typeshed/stdlib/tarfile.pyi @@ -1,3 +1,4 @@ +import io import sys from _typeshed import AnyPath, StrPath from types import TracebackType @@ -72,7 +73,11 @@ def open( compresslevel: Optional[int] = ..., ) -> TarFile: ... +class ExFileObject(io.BufferedReader): + def __init__(self, tarfile: TarFile, tarinfo: TarInfo) -> None: ... + class TarFile(Iterable[TarInfo]): + OPEN_METH: Mapping[str, str] name: Optional[AnyPath] mode: str fileobj: Optional[IO[bytes]] @@ -82,6 +87,7 @@ class TarFile(Iterable[TarInfo]): ignore_zeros: Optional[bool] encoding: Optional[str] errors: str + fileobject: Type[ExFileObject] pax_headers: Optional[Mapping[str, str]] debug: Optional[int] errorlevel: Optional[int] @@ -126,6 +132,74 @@ class TarFile(Iterable[TarInfo]): debug: Optional[int] = ..., errorlevel: Optional[int] = ..., ) -> TarFile: ... + @classmethod + def taropen( + cls, + name: Optional[AnyPath], + mode: str = ..., + fileobj: Optional[IO[bytes]] = ..., + *, + compresslevel: int = ..., + format: Optional[int] = ..., + tarinfo: Optional[Type[TarInfo]] = ..., + dereference: Optional[bool] = ..., + ignore_zeros: Optional[bool] = ..., + encoding: Optional[str] = ..., + pax_headers: Optional[Mapping[str, str]] = ..., + debug: Optional[int] = ..., + errorlevel: Optional[int] = ..., + ) -> TarFile: ... + @classmethod + def gzopen( + cls, + name: Optional[AnyPath], + mode: str = ..., + fileobj: Optional[IO[bytes]] = ..., + compresslevel: int = ..., + *, + format: Optional[int] = ..., + tarinfo: Optional[Type[TarInfo]] = ..., + dereference: Optional[bool] = ..., + ignore_zeros: Optional[bool] = ..., + encoding: Optional[str] = ..., + pax_headers: Optional[Mapping[str, str]] = ..., + debug: Optional[int] = ..., + errorlevel: Optional[int] = ..., + ) -> TarFile: ... + @classmethod + def bz2open( + cls, + name: Optional[AnyPath], + mode: str = ..., + fileobj: Optional[IO[bytes]] = ..., + compresslevel: int = ..., + *, + format: Optional[int] = ..., + tarinfo: Optional[Type[TarInfo]] = ..., + dereference: Optional[bool] = ..., + ignore_zeros: Optional[bool] = ..., + encoding: Optional[str] = ..., + pax_headers: Optional[Mapping[str, str]] = ..., + debug: Optional[int] = ..., + errorlevel: Optional[int] = ..., + ) -> TarFile: ... + @classmethod + def xzopen( + cls, + name: Optional[AnyPath], + mode: str = ..., + fileobj: Optional[IO[bytes]] = ..., + preset: Optional[int] = ..., + *, + format: Optional[int] = ..., + tarinfo: Optional[Type[TarInfo]] = ..., + dereference: Optional[bool] = ..., + ignore_zeros: Optional[bool] = ..., + encoding: Optional[str] = ..., + pax_headers: Optional[Mapping[str, str]] = ..., + debug: Optional[int] = ..., + errorlevel: Optional[int] = ..., + ) -> TarFile: ... def getmember(self, name: str) -> TarInfo: ... def getmembers(self) -> List[TarInfo]: ... def getnames(self) -> List[str]: ... @@ -218,6 +292,13 @@ class TarInfo: path: str size: int mtime: int + chksum: int + devmajor: int + devminor: int + offset: int + offset_data: int + sparse: Optional[bytes] + tarfile: Optional[TarFile] mode: int type: bytes linkname: str @@ -235,9 +316,24 @@ class TarInfo: def frombuf(cls, buf: bytes) -> TarInfo: ... @classmethod def fromtarfile(cls, tarfile: TarFile) -> TarInfo: ... + @property + def linkpath(self) -> str: ... + @linkpath.setter + def linkpath(self, linkname: str) -> None: ... + def get_info(self) -> Mapping[str, Union[str, int, bytes, Mapping[str, str]]]: ... def tobuf(self, format: Optional[int] = ..., encoding: Optional[str] = ..., errors: str = ...) -> bytes: ... + def create_ustar_header( + self, info: Mapping[str, Union[str, int, bytes, Mapping[str, str]]], encoding: str, errors: str + ) -> bytes: ... + def create_gnu_header( + self, info: Mapping[str, Union[str, int, bytes, Mapping[str, str]]], encoding: str, errors: str + ) -> bytes: ... + def create_pax_header(self, info: Mapping[str, Union[str, int, bytes, Mapping[str, str]]], encoding: str) -> bytes: ... + @classmethod + def create_pax_global_header(cls, pax_headers: Mapping[str, str]) -> bytes: ... def isfile(self) -> bool: ... def isreg(self) -> bool: ... + def issparse(self) -> bool: ... def isdir(self) -> bool: ... def issym(self) -> bool: ... def islnk(self) -> bool: ... diff --git a/python/helpers/typeshed/stdlib/3/tempfile.pyi b/python/helpers/typeshed/stdlib/tempfile.pyi similarity index 99% rename from python/helpers/typeshed/stdlib/3/tempfile.pyi rename to python/helpers/typeshed/stdlib/tempfile.pyi index 7dd680321192..a2ef7724b84a 100644 --- a/python/helpers/typeshed/stdlib/3/tempfile.pyi +++ b/python/helpers/typeshed/stdlib/tempfile.pyi @@ -13,8 +13,7 @@ tempdir: Optional[str] template: str _S = TypeVar("_S") -_T = TypeVar("_T") # for pytype, define typevar in same file as alias -_DirT = Union[_T, os.PathLike[_T]] +_DirT = Union[AnyStr, os.PathLike[AnyStr]] if sys.version_info >= (3, 8): @overload diff --git a/python/helpers/typeshed/stdlib/2and3/termios.pyi b/python/helpers/typeshed/stdlib/termios.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/termios.pyi rename to python/helpers/typeshed/stdlib/termios.pyi diff --git a/python/helpers/typeshed/stdlib/3/textwrap.pyi b/python/helpers/typeshed/stdlib/textwrap.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/textwrap.pyi rename to python/helpers/typeshed/stdlib/textwrap.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/this.pyi b/python/helpers/typeshed/stdlib/this.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/this.pyi rename to python/helpers/typeshed/stdlib/this.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/threading.pyi b/python/helpers/typeshed/stdlib/threading.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/threading.pyi rename to python/helpers/typeshed/stdlib/threading.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/time.pyi b/python/helpers/typeshed/stdlib/time.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/time.pyi rename to python/helpers/typeshed/stdlib/time.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/token.pyi b/python/helpers/typeshed/stdlib/token.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/token.pyi rename to python/helpers/typeshed/stdlib/token.pyi diff --git a/python/helpers/typeshed/stdlib/3/tokenize.pyi b/python/helpers/typeshed/stdlib/tokenize.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/tokenize.pyi rename to python/helpers/typeshed/stdlib/tokenize.pyi diff --git a/python/helpers/typeshed/stdlib/3/tracemalloc.pyi b/python/helpers/typeshed/stdlib/tracemalloc.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/tracemalloc.pyi rename to python/helpers/typeshed/stdlib/tracemalloc.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/turtle.pyi b/python/helpers/typeshed/stdlib/turtle.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/turtle.pyi rename to python/helpers/typeshed/stdlib/turtle.pyi diff --git a/python/helpers/typeshed/stdlib/3/types.pyi b/python/helpers/typeshed/stdlib/types.pyi similarity index 99% rename from python/helpers/typeshed/stdlib/3/types.pyi rename to python/helpers/typeshed/stdlib/types.pyi index d5b419c177ed..22ec7e5aae63 100644 --- a/python/helpers/typeshed/stdlib/3/types.pyi +++ b/python/helpers/typeshed/stdlib/types.pyi @@ -331,4 +331,6 @@ if sys.version_info >= (3, 10): class NoneType: def __bool__(self) -> Literal[False]: ... EllipsisType = ellipsis # noqa F811 from builtins + from builtins import _NotImplementedType + NotImplementedType = _NotImplementedType # noqa F811 from builtins diff --git a/python/helpers/typeshed/stdlib/3/typing.pyi b/python/helpers/typeshed/stdlib/typing.pyi similarity index 98% rename from python/helpers/typeshed/stdlib/3/typing.pyi rename to python/helpers/typeshed/stdlib/typing.pyi index 0175a773f4e4..07c2cefe99e4 100644 --- a/python/helpers/typeshed/stdlib/3/typing.pyi +++ b/python/helpers/typeshed/stdlib/typing.pyi @@ -362,7 +362,7 @@ class MutableSet(AbstractSet[_T], Generic[_T]): def __isub__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ... class MappingView(Sized): - def __init__(self, mapping: Mapping[_KT_co, _VT_co]) -> None: ... # undocumented + def __init__(self, mapping: Mapping[Any, Any]) -> None: ... # undocumented def __len__(self) -> int: ... class ItemsView(MappingView, AbstractSet[Tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]): @@ -381,7 +381,7 @@ class ItemsView(MappingView, AbstractSet[Tuple[_KT_co, _VT_co]], Generic[_KT_co, def __rxor__(self, o: Iterable[_T]) -> Set[Union[Tuple[_KT_co, _VT_co], _T]]: ... class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]): - def __init__(self, mapping: Mapping[_KT_co, _VT_co]) -> None: ... # undocumented + def __init__(self, mapping: Mapping[_KT_co, Any]) -> None: ... # undocumented def __and__(self, o: Iterable[Any]) -> Set[_KT_co]: ... def __rand__(self, o: Iterable[_T]) -> Set[_T]: ... def __contains__(self, o: object) -> bool: ... @@ -396,7 +396,7 @@ class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]): def __rxor__(self, o: Iterable[_T]) -> Set[Union[_KT_co, _T]]: ... class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]): - def __init__(self, mapping: Mapping[_KT_co, _VT_co]) -> None: ... # undocumented + def __init__(self, mapping: Mapping[Any, _VT_co]) -> None: ... # undocumented def __contains__(self, o: object) -> bool: ... def __iter__(self) -> Iterator[_VT_co]: ... if sys.version_info >= (3, 8): @@ -661,12 +661,14 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta): # can go through. def setdefault(self, k: NoReturn, default: object) -> object: ... # Mypy plugin hook for 'pop' expects that 'default' has a type variable type. - def pop(self, k: NoReturn, default: _T = ...) -> object: ... + def pop(self, k: NoReturn, default: _T = ...) -> object: ... # type: ignore def update(self: _T, __m: _T) -> None: ... def __delitem__(self, k: NoReturn) -> None: ... def items(self) -> ItemsView[str, object]: ... def keys(self) -> KeysView[str]: ... def values(self) -> ValuesView[object]: ... + def __or__(self: _T, __value: _T) -> _T: ... + def __ior__(self: _T, __value: _T) -> _T: ... def NewType(name: str, tp: Type[_T]) -> Type[_T]: ... diff --git a/python/helpers/typeshed/stdlib/3/unittest/__init__.pyi b/python/helpers/typeshed/stdlib/unittest/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/unittest/__init__.pyi rename to python/helpers/typeshed/stdlib/unittest/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/unittest/async_case.pyi b/python/helpers/typeshed/stdlib/unittest/async_case.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/unittest/async_case.pyi rename to python/helpers/typeshed/stdlib/unittest/async_case.pyi diff --git a/python/helpers/typeshed/stdlib/3/unittest/case.pyi b/python/helpers/typeshed/stdlib/unittest/case.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/unittest/case.pyi rename to python/helpers/typeshed/stdlib/unittest/case.pyi diff --git a/python/helpers/typeshed/stdlib/3/unittest/loader.pyi b/python/helpers/typeshed/stdlib/unittest/loader.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/unittest/loader.pyi rename to python/helpers/typeshed/stdlib/unittest/loader.pyi diff --git a/python/helpers/typeshed/stdlib/3/unittest/main.pyi b/python/helpers/typeshed/stdlib/unittest/main.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/unittest/main.pyi rename to python/helpers/typeshed/stdlib/unittest/main.pyi diff --git a/python/helpers/typeshed/stdlib/3/unittest/mock.pyi b/python/helpers/typeshed/stdlib/unittest/mock.pyi similarity index 98% rename from python/helpers/typeshed/stdlib/3/unittest/mock.pyi rename to python/helpers/typeshed/stdlib/unittest/mock.pyi index 4d866a20b275..fd767272e66a 100644 --- a/python/helpers/typeshed/stdlib/3/unittest/mock.pyi +++ b/python/helpers/typeshed/stdlib/unittest/mock.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Callable, Generic, List, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, overload +from typing import Any, Callable, Generic, Iterable, List, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, overload _F = TypeVar("_F", bound=Callable[..., Any]) _T = TypeVar("_T") @@ -342,7 +342,7 @@ if sys.version_info >= (3, 8): def assert_awaited_with(self, *args: Any, **kwargs: Any) -> None: ... def assert_awaited_once_with(self, *args: Any, **kwargs: Any) -> None: ... def assert_any_await(self, *args: Any, **kwargs: Any) -> None: ... - def assert_has_awaits(self, calls: _CallList, any_order: bool = ...) -> None: ... + def assert_has_awaits(self, calls: Iterable[_Call], any_order: bool = ...) -> None: ... def assert_not_awaited(self) -> None: ... def reset_mock(self, *args: Any, **kwargs: Any) -> None: ... await_count: int diff --git a/python/helpers/typeshed/stdlib/3/unittest/result.pyi b/python/helpers/typeshed/stdlib/unittest/result.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/unittest/result.pyi rename to python/helpers/typeshed/stdlib/unittest/result.pyi diff --git a/python/helpers/typeshed/stdlib/3/unittest/runner.pyi b/python/helpers/typeshed/stdlib/unittest/runner.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/unittest/runner.pyi rename to python/helpers/typeshed/stdlib/unittest/runner.pyi diff --git a/python/helpers/typeshed/stdlib/3/unittest/signals.pyi b/python/helpers/typeshed/stdlib/unittest/signals.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/unittest/signals.pyi rename to python/helpers/typeshed/stdlib/unittest/signals.pyi diff --git a/python/helpers/typeshed/stdlib/3/unittest/suite.pyi b/python/helpers/typeshed/stdlib/unittest/suite.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/unittest/suite.pyi rename to python/helpers/typeshed/stdlib/unittest/suite.pyi diff --git a/python/helpers/typeshed/stdlib/3/unittest/util.pyi b/python/helpers/typeshed/stdlib/unittest/util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/unittest/util.pyi rename to python/helpers/typeshed/stdlib/unittest/util.pyi diff --git a/python/helpers/typeshed/stdlib/3/distutils/command/__init__.pyi b/python/helpers/typeshed/stdlib/urllib/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/distutils/command/__init__.pyi rename to python/helpers/typeshed/stdlib/urllib/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/urllib/error.pyi b/python/helpers/typeshed/stdlib/urllib/error.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/urllib/error.pyi rename to python/helpers/typeshed/stdlib/urllib/error.pyi diff --git a/python/helpers/typeshed/stdlib/3/urllib/parse.pyi b/python/helpers/typeshed/stdlib/urllib/parse.pyi similarity index 82% rename from python/helpers/typeshed/stdlib/3/urllib/parse.pyi rename to python/helpers/typeshed/stdlib/urllib/parse.pyi index d9ecfa4b6ac0..00bdb5109044 100644 --- a/python/helpers/typeshed/stdlib/3/urllib/parse.pyi +++ b/python/helpers/typeshed/stdlib/urllib/parse.pyi @@ -79,32 +79,24 @@ class DefragResultBytes(_DefragResultBase[bytes], _ResultMixinBytes): ... class SplitResultBytes(_SplitResultBytesBase, _NetlocResultMixinBytes): ... class ParseResultBytes(_ParseResultBytesBase, _NetlocResultMixinBytes): ... -if sys.version_info >= (3, 8): - def parse_qs( - qs: Optional[AnyStr], - keep_blank_values: bool = ..., - strict_parsing: bool = ..., - encoding: str = ..., - errors: str = ..., - max_num_fields: Optional[int] = ..., - ) -> Dict[AnyStr, List[AnyStr]]: ... - def parse_qsl( - qs: Optional[AnyStr], - keep_blank_values: bool = ..., - strict_parsing: bool = ..., - encoding: str = ..., - errors: str = ..., - max_num_fields: Optional[int] = ..., - ) -> List[Tuple[AnyStr, AnyStr]]: ... - -else: - def parse_qs( - qs: Optional[AnyStr], keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ... - ) -> Dict[AnyStr, List[AnyStr]]: ... - def parse_qsl( - qs: Optional[AnyStr], keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ... - ) -> List[Tuple[AnyStr, AnyStr]]: ... - +def parse_qs( + qs: Optional[AnyStr], + keep_blank_values: bool = ..., + strict_parsing: bool = ..., + encoding: str = ..., + errors: str = ..., + max_num_fields: Optional[int] = ..., + separator: str = ..., +) -> Dict[AnyStr, List[AnyStr]]: ... +def parse_qsl( + qs: Optional[AnyStr], + keep_blank_values: bool = ..., + strict_parsing: bool = ..., + encoding: str = ..., + errors: str = ..., + max_num_fields: Optional[int] = ..., + separator: str = ..., +) -> List[Tuple[AnyStr, AnyStr]]: ... @overload def quote(string: str, safe: _Str = ..., encoding: Optional[str] = ..., errors: Optional[str] = ...) -> str: ... @overload diff --git a/python/helpers/typeshed/stdlib/3/urllib/request.pyi b/python/helpers/typeshed/stdlib/urllib/request.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/urllib/request.pyi rename to python/helpers/typeshed/stdlib/urllib/request.pyi diff --git a/python/helpers/typeshed/stdlib/3/urllib/response.pyi b/python/helpers/typeshed/stdlib/urllib/response.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/urllib/response.pyi rename to python/helpers/typeshed/stdlib/urllib/response.pyi diff --git a/python/helpers/typeshed/stdlib/3/urllib/robotparser.pyi b/python/helpers/typeshed/stdlib/urllib/robotparser.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/urllib/robotparser.pyi rename to python/helpers/typeshed/stdlib/urllib/robotparser.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/uu.pyi b/python/helpers/typeshed/stdlib/uu.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/uu.pyi rename to python/helpers/typeshed/stdlib/uu.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/uuid.pyi b/python/helpers/typeshed/stdlib/uuid.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/uuid.pyi rename to python/helpers/typeshed/stdlib/uuid.pyi diff --git a/python/helpers/typeshed/stdlib/3/venv/__init__.pyi b/python/helpers/typeshed/stdlib/venv/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/venv/__init__.pyi rename to python/helpers/typeshed/stdlib/venv/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/warnings.pyi b/python/helpers/typeshed/stdlib/warnings.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/warnings.pyi rename to python/helpers/typeshed/stdlib/warnings.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/wave.pyi b/python/helpers/typeshed/stdlib/wave.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/wave.pyi rename to python/helpers/typeshed/stdlib/wave.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/webbrowser.pyi b/python/helpers/typeshed/stdlib/webbrowser.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/webbrowser.pyi rename to python/helpers/typeshed/stdlib/webbrowser.pyi diff --git a/python/helpers/typeshed/stdlib/3/winreg.pyi b/python/helpers/typeshed/stdlib/winreg.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/winreg.pyi rename to python/helpers/typeshed/stdlib/winreg.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/winsound.pyi b/python/helpers/typeshed/stdlib/winsound.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/winsound.pyi rename to python/helpers/typeshed/stdlib/winsound.pyi diff --git a/python/helpers/typeshed/stdlib/3/email/mime/__init__.pyi b/python/helpers/typeshed/stdlib/wsgiref/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/email/mime/__init__.pyi rename to python/helpers/typeshed/stdlib/wsgiref/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/wsgiref/handlers.pyi b/python/helpers/typeshed/stdlib/wsgiref/handlers.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/wsgiref/handlers.pyi rename to python/helpers/typeshed/stdlib/wsgiref/handlers.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/wsgiref/headers.pyi b/python/helpers/typeshed/stdlib/wsgiref/headers.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/wsgiref/headers.pyi rename to python/helpers/typeshed/stdlib/wsgiref/headers.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/wsgiref/simple_server.pyi b/python/helpers/typeshed/stdlib/wsgiref/simple_server.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/wsgiref/simple_server.pyi rename to python/helpers/typeshed/stdlib/wsgiref/simple_server.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/wsgiref/types.pyi b/python/helpers/typeshed/stdlib/wsgiref/types.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/wsgiref/types.pyi rename to python/helpers/typeshed/stdlib/wsgiref/types.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/wsgiref/util.pyi b/python/helpers/typeshed/stdlib/wsgiref/util.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/wsgiref/util.pyi rename to python/helpers/typeshed/stdlib/wsgiref/util.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/wsgiref/validate.pyi b/python/helpers/typeshed/stdlib/wsgiref/validate.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/wsgiref/validate.pyi rename to python/helpers/typeshed/stdlib/wsgiref/validate.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/__init__.pyi b/python/helpers/typeshed/stdlib/xml/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/__init__.pyi rename to python/helpers/typeshed/stdlib/xml/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/dom/NodeFilter.pyi b/python/helpers/typeshed/stdlib/xml/dom/NodeFilter.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/dom/NodeFilter.pyi rename to python/helpers/typeshed/stdlib/xml/dom/NodeFilter.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/dom/__init__.pyi b/python/helpers/typeshed/stdlib/xml/dom/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/dom/__init__.pyi rename to python/helpers/typeshed/stdlib/xml/dom/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/dom/domreg.pyi b/python/helpers/typeshed/stdlib/xml/dom/domreg.pyi similarity index 84% rename from python/helpers/typeshed/stdlib/2and3/xml/dom/domreg.pyi rename to python/helpers/typeshed/stdlib/xml/dom/domreg.pyi index 6f479b097b65..bf63ff09e106 100644 --- a/python/helpers/typeshed/stdlib/2and3/xml/dom/domreg.pyi +++ b/python/helpers/typeshed/stdlib/xml/dom/domreg.pyi @@ -1,5 +1,5 @@ from _typeshed.xml import DOMImplementation -from typing import Any, Callable, Dict, Iterable, Optional, Tuple, Union +from typing import Callable, Dict, Iterable, Optional, Tuple, Union well_known_implementations: Dict[str, str] registered: Dict[str, Callable[[], DOMImplementation]] diff --git a/python/helpers/typeshed/stdlib/2and3/xml/dom/expatbuilder.pyi b/python/helpers/typeshed/stdlib/xml/dom/expatbuilder.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/dom/expatbuilder.pyi rename to python/helpers/typeshed/stdlib/xml/dom/expatbuilder.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/dom/minicompat.pyi b/python/helpers/typeshed/stdlib/xml/dom/minicompat.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/dom/minicompat.pyi rename to python/helpers/typeshed/stdlib/xml/dom/minicompat.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/dom/minidom.pyi b/python/helpers/typeshed/stdlib/xml/dom/minidom.pyi similarity index 53% rename from python/helpers/typeshed/stdlib/2and3/xml/dom/minidom.pyi rename to python/helpers/typeshed/stdlib/xml/dom/minidom.pyi index 7a6eb192b384..dc128e016548 100644 --- a/python/helpers/typeshed/stdlib/2and3/xml/dom/minidom.pyi +++ b/python/helpers/typeshed/stdlib/xml/dom/minidom.pyi @@ -1,6 +1,6 @@ -from typing import Any, Optional, Text, Union +from typing import IO, Any, Optional, Text, Union from xml.sax.xmlreader import XMLReader -def parse(file: str, parser: Optional[XMLReader] = ..., bufsize: Optional[int] = ...): ... +def parse(file: Union[str, IO[Any]], parser: Optional[XMLReader] = ..., bufsize: Optional[int] = ...): ... def parseString(string: Union[bytes, Text], parser: Optional[XMLReader] = ...): ... def __getattr__(name: str) -> Any: ... # incomplete diff --git a/python/helpers/typeshed/stdlib/2and3/xml/dom/pulldom.pyi b/python/helpers/typeshed/stdlib/xml/dom/pulldom.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/dom/pulldom.pyi rename to python/helpers/typeshed/stdlib/xml/dom/pulldom.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/dom/xmlbuilder.pyi b/python/helpers/typeshed/stdlib/xml/dom/xmlbuilder.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/dom/xmlbuilder.pyi rename to python/helpers/typeshed/stdlib/xml/dom/xmlbuilder.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/etree/ElementInclude.pyi b/python/helpers/typeshed/stdlib/xml/etree/ElementInclude.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/etree/ElementInclude.pyi rename to python/helpers/typeshed/stdlib/xml/etree/ElementInclude.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/etree/ElementPath.pyi b/python/helpers/typeshed/stdlib/xml/etree/ElementPath.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/etree/ElementPath.pyi rename to python/helpers/typeshed/stdlib/xml/etree/ElementPath.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/etree/ElementTree.pyi b/python/helpers/typeshed/stdlib/xml/etree/ElementTree.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/etree/ElementTree.pyi rename to python/helpers/typeshed/stdlib/xml/etree/ElementTree.pyi diff --git a/python/helpers/typeshed/stdlib/3/urllib/__init__.pyi b/python/helpers/typeshed/stdlib/xml/etree/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/urllib/__init__.pyi rename to python/helpers/typeshed/stdlib/xml/etree/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/etree/cElementTree.pyi b/python/helpers/typeshed/stdlib/xml/etree/cElementTree.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/etree/cElementTree.pyi rename to python/helpers/typeshed/stdlib/xml/etree/cElementTree.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/parsers/__init__.pyi b/python/helpers/typeshed/stdlib/xml/parsers/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/parsers/__init__.pyi rename to python/helpers/typeshed/stdlib/xml/parsers/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/parsers/expat/__init__.pyi b/python/helpers/typeshed/stdlib/xml/parsers/expat/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/parsers/expat/__init__.pyi rename to python/helpers/typeshed/stdlib/xml/parsers/expat/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/parsers/expat/errors.pyi b/python/helpers/typeshed/stdlib/xml/parsers/expat/errors.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/parsers/expat/errors.pyi rename to python/helpers/typeshed/stdlib/xml/parsers/expat/errors.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/parsers/expat/model.pyi b/python/helpers/typeshed/stdlib/xml/parsers/expat/model.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/parsers/expat/model.pyi rename to python/helpers/typeshed/stdlib/xml/parsers/expat/model.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/sax/__init__.pyi b/python/helpers/typeshed/stdlib/xml/sax/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/sax/__init__.pyi rename to python/helpers/typeshed/stdlib/xml/sax/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/sax/handler.pyi b/python/helpers/typeshed/stdlib/xml/sax/handler.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/sax/handler.pyi rename to python/helpers/typeshed/stdlib/xml/sax/handler.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/sax/saxutils.pyi b/python/helpers/typeshed/stdlib/xml/sax/saxutils.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/sax/saxutils.pyi rename to python/helpers/typeshed/stdlib/xml/sax/saxutils.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/xml/sax/xmlreader.pyi b/python/helpers/typeshed/stdlib/xml/sax/xmlreader.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/xml/sax/xmlreader.pyi rename to python/helpers/typeshed/stdlib/xml/sax/xmlreader.pyi diff --git a/python/helpers/typeshed/stdlib/3/xmlrpc/__init__.pyi b/python/helpers/typeshed/stdlib/xmlrpc/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/xmlrpc/__init__.pyi rename to python/helpers/typeshed/stdlib/xmlrpc/__init__.pyi diff --git a/python/helpers/typeshed/stdlib/3/xmlrpc/client.pyi b/python/helpers/typeshed/stdlib/xmlrpc/client.pyi similarity index 99% rename from python/helpers/typeshed/stdlib/3/xmlrpc/client.pyi rename to python/helpers/typeshed/stdlib/xmlrpc/client.pyi index 7bea294bbfab..412382297d85 100644 --- a/python/helpers/typeshed/stdlib/3/xmlrpc/client.pyi +++ b/python/helpers/typeshed/stdlib/xmlrpc/client.pyi @@ -47,9 +47,9 @@ class ResponseError(Error): ... class Fault(Error): - faultCode: str + faultCode: int faultString: str - def __init__(self, faultCode: str, faultString: str, **extra: Any) -> None: ... + def __init__(self, faultCode: int, faultString: str, **extra: Any) -> None: ... boolean = bool Boolean = bool diff --git a/python/helpers/typeshed/stdlib/3/xmlrpc/server.pyi b/python/helpers/typeshed/stdlib/xmlrpc/server.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/xmlrpc/server.pyi rename to python/helpers/typeshed/stdlib/xmlrpc/server.pyi diff --git a/python/helpers/typeshed/stdlib/3/zipapp.pyi b/python/helpers/typeshed/stdlib/zipapp.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3/zipapp.pyi rename to python/helpers/typeshed/stdlib/zipapp.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/zipfile.pyi b/python/helpers/typeshed/stdlib/zipfile.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/zipfile.pyi rename to python/helpers/typeshed/stdlib/zipfile.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/zipimport.pyi b/python/helpers/typeshed/stdlib/zipimport.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/2and3/zipimport.pyi rename to python/helpers/typeshed/stdlib/zipimport.pyi diff --git a/python/helpers/typeshed/stdlib/2and3/zlib.pyi b/python/helpers/typeshed/stdlib/zlib.pyi similarity index 98% rename from python/helpers/typeshed/stdlib/2and3/zlib.pyi rename to python/helpers/typeshed/stdlib/zlib.pyi index 3675784675c6..1d7f06274fc1 100644 --- a/python/helpers/typeshed/stdlib/2and3/zlib.pyi +++ b/python/helpers/typeshed/stdlib/zlib.pyi @@ -12,9 +12,11 @@ Z_DEFAULT_COMPRESSION: int Z_DEFAULT_STRATEGY: int Z_FILTERED: int Z_FINISH: int +Z_FIXED: int Z_FULL_FLUSH: int Z_HUFFMAN_ONLY: int Z_NO_FLUSH: int +Z_RLE: int Z_SYNC_FLUSH: int if sys.version_info >= (3,): DEF_BUF_SIZE: int diff --git a/python/helpers/typeshed/stdlib/3.9/zoneinfo/__init__.pyi b/python/helpers/typeshed/stdlib/zoneinfo/__init__.pyi similarity index 100% rename from python/helpers/typeshed/stdlib/3.9/zoneinfo/__init__.pyi rename to python/helpers/typeshed/stdlib/zoneinfo/__init__.pyi diff --git a/python/helpers/typeshed/stubs/Deprecated/METADATA.toml b/python/helpers/typeshed/stubs/Deprecated/METADATA.toml new file mode 100644 index 000000000000..c2e2517588a9 --- /dev/null +++ b/python/helpers/typeshed/stubs/Deprecated/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +requires = ["types-typing-extensions"] diff --git a/python/helpers/typeshed/third_party/2and3/deprecated/__init__.pyi b/python/helpers/typeshed/stubs/Deprecated/deprecated/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/deprecated/__init__.pyi rename to python/helpers/typeshed/stubs/Deprecated/deprecated/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/deprecated/classic.pyi b/python/helpers/typeshed/stubs/Deprecated/deprecated/classic.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/deprecated/classic.pyi rename to python/helpers/typeshed/stubs/Deprecated/deprecated/classic.pyi diff --git a/python/helpers/typeshed/third_party/2and3/deprecated/sphinx.pyi b/python/helpers/typeshed/stubs/Deprecated/deprecated/sphinx.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/deprecated/sphinx.pyi rename to python/helpers/typeshed/stubs/Deprecated/deprecated/sphinx.pyi diff --git a/python/helpers/typeshed/stubs/JACK-Client/METADATA.toml b/python/helpers/typeshed/stubs/JACK-Client/METADATA.toml new file mode 100644 index 000000000000..5f1541084942 --- /dev/null +++ b/python/helpers/typeshed/stubs/JACK-Client/METADATA.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/python/helpers/typeshed/third_party/3/jack/__init__.pyi b/python/helpers/typeshed/stubs/JACK-Client/jack/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/jack/__init__.pyi rename to python/helpers/typeshed/stubs/JACK-Client/jack/__init__.pyi diff --git a/python/helpers/typeshed/stubs/Markdown/METADATA.toml b/python/helpers/typeshed/stubs/Markdown/METADATA.toml new file mode 100644 index 000000000000..c2e2517588a9 --- /dev/null +++ b/python/helpers/typeshed/stubs/Markdown/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +requires = ["types-typing-extensions"] diff --git a/python/helpers/typeshed/third_party/2and3/markdown/__init__.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/__init__.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/__meta__.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/__meta__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/__meta__.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/__meta__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/blockparser.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/blockparser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/blockparser.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/blockparser.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/blockprocessors.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/blockprocessors.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/blockprocessors.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/blockprocessors.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/core.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/core.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/core.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/core.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/__init__.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/__init__.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/abbr.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/abbr.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/abbr.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/abbr.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/admonition.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/admonition.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/admonition.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/admonition.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/attr_list.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/attr_list.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/attr_list.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/attr_list.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/codehilite.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/codehilite.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/codehilite.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/codehilite.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/def_list.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/def_list.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/def_list.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/def_list.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/extra.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/extra.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/extra.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/extra.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/fenced_code.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/fenced_code.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/fenced_code.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/fenced_code.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/footnotes.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/footnotes.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/footnotes.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/footnotes.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/legacy_attrs.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/legacy_attrs.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/legacy_attrs.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/legacy_attrs.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/legacy_em.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/legacy_em.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/legacy_em.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/legacy_em.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/md_in_html.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/md_in_html.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/md_in_html.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/md_in_html.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/meta.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/meta.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/meta.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/meta.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/nl2br.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/nl2br.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/nl2br.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/nl2br.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/sane_lists.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/sane_lists.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/sane_lists.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/sane_lists.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/smarty.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/smarty.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/smarty.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/smarty.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/tables.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/tables.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/tables.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/tables.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/toc.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/toc.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/toc.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/toc.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/extensions/wikilinks.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/extensions/wikilinks.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/extensions/wikilinks.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/extensions/wikilinks.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/inlinepatterns.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/inlinepatterns.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/inlinepatterns.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/inlinepatterns.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/pep562.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/pep562.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/pep562.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/pep562.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/postprocessors.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/postprocessors.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/postprocessors.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/postprocessors.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/preprocessors.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/preprocessors.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/preprocessors.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/preprocessors.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/serializers.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/serializers.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/serializers.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/serializers.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/treeprocessors.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/treeprocessors.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/treeprocessors.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/treeprocessors.pyi diff --git a/python/helpers/typeshed/third_party/2and3/markdown/util.pyi b/python/helpers/typeshed/stubs/Markdown/markdown/util.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/markdown/util.pyi rename to python/helpers/typeshed/stubs/Markdown/markdown/util.pyi diff --git a/python/helpers/typeshed/stubs/Werkzeug/METADATA.toml b/python/helpers/typeshed/stubs/Werkzeug/METADATA.toml new file mode 100644 index 000000000000..c2e2517588a9 --- /dev/null +++ b/python/helpers/typeshed/stubs/Werkzeug/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +requires = ["types-typing-extensions"] diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/__init__.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/__init__.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/_compat.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/_compat.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/_compat.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/_compat.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/_internal.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/_internal.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/_internal.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/_internal.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/_reloader.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/_reloader.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/_reloader.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/_reloader.pyi diff --git a/python/helpers/typeshed/third_party/2/concurrent/__init__.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/concurrent/__init__.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/atom.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/atom.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/atom.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/atom.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/cache.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/cache.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/cache.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/cache.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/fixers.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/fixers.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/fixers.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/fixers.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/iterio.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/iterio.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/iterio.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/iterio.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/jsrouting.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/jsrouting.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/jsrouting.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/jsrouting.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/limiter.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/limiter.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/limiter.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/limiter.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/lint.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/lint.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/lint.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/lint.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/profiler.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/profiler.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/profiler.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/profiler.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/securecookie.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/securecookie.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/securecookie.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/securecookie.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/sessions.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/sessions.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/sessions.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/sessions.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/testtools.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/testtools.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/testtools.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/testtools.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/wrappers.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/wrappers.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/wrappers.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/contrib/wrappers.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/datastructures.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/datastructures.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/datastructures.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/datastructures.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/debug/__init__.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/debug/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/debug/__init__.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/debug/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/debug/console.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/debug/console.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/debug/console.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/debug/console.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/debug/repr.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/debug/repr.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/debug/repr.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/debug/repr.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/debug/tbtools.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/debug/tbtools.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/debug/tbtools.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/debug/tbtools.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/exceptions.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/exceptions.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/exceptions.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/exceptions.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/filesystem.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/filesystem.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/filesystem.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/filesystem.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/formparser.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/formparser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/formparser.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/formparser.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/http.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/http.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/http.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/http.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/local.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/local.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/local.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/local.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/__init__.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/__init__.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/middleware/dispatcher.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/dispatcher.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/middleware/dispatcher.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/dispatcher.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/middleware/http_proxy.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/http_proxy.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/middleware/http_proxy.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/http_proxy.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/middleware/lint.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/lint.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/middleware/lint.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/lint.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/middleware/profiler.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/profiler.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/middleware/profiler.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/profiler.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/middleware/proxy_fix.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/proxy_fix.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/middleware/proxy_fix.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/proxy_fix.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/middleware/shared_data.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/shared_data.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/middleware/shared_data.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/middleware/shared_data.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/posixemulation.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/posixemulation.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/posixemulation.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/posixemulation.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/routing.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/routing.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/routing.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/routing.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/script.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/script.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/script.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/script.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/security.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/security.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/security.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/security.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/serving.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/serving.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/serving.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/serving.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/test.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/test.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/test.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/test.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/testapp.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/testapp.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/testapp.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/testapp.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/urls.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/urls.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/urls.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/urls.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/useragents.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/useragents.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/useragents.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/useragents.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/utils.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/utils.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/utils.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/utils.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/wrappers.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/wrappers.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/wrappers.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/wrappers.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/wsgi.pyi b/python/helpers/typeshed/stubs/Werkzeug/werkzeug/wsgi.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/wsgi.pyi rename to python/helpers/typeshed/stubs/Werkzeug/werkzeug/wsgi.pyi diff --git a/python/helpers/typeshed/stubs/aiofiles/METADATA.toml b/python/helpers/typeshed/stubs/aiofiles/METADATA.toml new file mode 100644 index 000000000000..1071ae7e9d86 --- /dev/null +++ b/python/helpers/typeshed/stubs/aiofiles/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +requires = ["types-typing-extensions"] diff --git a/python/helpers/typeshed/third_party/3/aiofiles/__init__.pyi b/python/helpers/typeshed/stubs/aiofiles/aiofiles/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/aiofiles/__init__.pyi rename to python/helpers/typeshed/stubs/aiofiles/aiofiles/__init__.pyi diff --git a/python/helpers/typeshed/third_party/3/aiofiles/base.pyi b/python/helpers/typeshed/stubs/aiofiles/aiofiles/base.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/aiofiles/base.pyi rename to python/helpers/typeshed/stubs/aiofiles/aiofiles/base.pyi diff --git a/python/helpers/typeshed/third_party/3/aiofiles/os.pyi b/python/helpers/typeshed/stubs/aiofiles/aiofiles/os.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/aiofiles/os.pyi rename to python/helpers/typeshed/stubs/aiofiles/aiofiles/os.pyi diff --git a/python/helpers/typeshed/third_party/3/aiofiles/threadpool/__init__.pyi b/python/helpers/typeshed/stubs/aiofiles/aiofiles/threadpool/__init__.pyi similarity index 95% rename from python/helpers/typeshed/third_party/3/aiofiles/threadpool/__init__.pyi rename to python/helpers/typeshed/stubs/aiofiles/aiofiles/threadpool/__init__.pyi index bde6ad8a36ce..dd6480404852 100644 --- a/python/helpers/typeshed/third_party/3/aiofiles/threadpool/__init__.pyi +++ b/python/helpers/typeshed/stubs/aiofiles/aiofiles/threadpool/__init__.pyi @@ -1,13 +1,13 @@ from _typeshed import AnyPath, OpenBinaryMode, OpenBinaryModeReading, OpenBinaryModeUpdating, OpenBinaryModeWriting, OpenTextMode from asyncio import AbstractEventLoop -from typing import Any, Callable, Optional, TypeVar, Union, overload +from typing import Any, Callable, Optional, Union, overload from typing_extensions import Literal from ..base import AiofilesContextManager from .binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO, _UnknownAsyncBinaryIO from .text import AsyncTextIOWrapper -_OpenFile = TypeVar("_OpenFile", bound=Union[AnyPath, int]) +_OpenFile = Union[AnyPath, int] _Opener = Callable[[str, int], int] # Text mode: always returns AsyncTextIOWrapper diff --git a/python/helpers/typeshed/third_party/3/aiofiles/threadpool/binary.pyi b/python/helpers/typeshed/stubs/aiofiles/aiofiles/threadpool/binary.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/aiofiles/threadpool/binary.pyi rename to python/helpers/typeshed/stubs/aiofiles/aiofiles/threadpool/binary.pyi diff --git a/python/helpers/typeshed/third_party/3/aiofiles/threadpool/text.pyi b/python/helpers/typeshed/stubs/aiofiles/aiofiles/threadpool/text.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/aiofiles/threadpool/text.pyi rename to python/helpers/typeshed/stubs/aiofiles/aiofiles/threadpool/text.pyi diff --git a/python/helpers/typeshed/stubs/atomicwrites/METADATA.toml b/python/helpers/typeshed/stubs/atomicwrites/METADATA.toml new file mode 100644 index 000000000000..31f638bf33df --- /dev/null +++ b/python/helpers/typeshed/stubs/atomicwrites/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +python2 = true diff --git a/python/helpers/typeshed/third_party/2and3/atomicwrites/__init__.pyi b/python/helpers/typeshed/stubs/atomicwrites/atomicwrites/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/atomicwrites/__init__.pyi rename to python/helpers/typeshed/stubs/atomicwrites/atomicwrites/__init__.pyi diff --git a/python/helpers/typeshed/stubs/attrs/METADATA.toml b/python/helpers/typeshed/stubs/attrs/METADATA.toml new file mode 100644 index 000000000000..31f638bf33df --- /dev/null +++ b/python/helpers/typeshed/stubs/attrs/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +python2 = true diff --git a/python/helpers/typeshed/third_party/2and3/attr/__init__.pyi b/python/helpers/typeshed/stubs/attrs/attr/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/attr/__init__.pyi rename to python/helpers/typeshed/stubs/attrs/attr/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/attr/_version_info.pyi b/python/helpers/typeshed/stubs/attrs/attr/_version_info.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/attr/_version_info.pyi rename to python/helpers/typeshed/stubs/attrs/attr/_version_info.pyi diff --git a/python/helpers/typeshed/third_party/2and3/attr/converters.pyi b/python/helpers/typeshed/stubs/attrs/attr/converters.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/attr/converters.pyi rename to python/helpers/typeshed/stubs/attrs/attr/converters.pyi diff --git a/python/helpers/typeshed/third_party/2and3/attr/exceptions.pyi b/python/helpers/typeshed/stubs/attrs/attr/exceptions.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/attr/exceptions.pyi rename to python/helpers/typeshed/stubs/attrs/attr/exceptions.pyi diff --git a/python/helpers/typeshed/third_party/2and3/attr/filters.pyi b/python/helpers/typeshed/stubs/attrs/attr/filters.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/attr/filters.pyi rename to python/helpers/typeshed/stubs/attrs/attr/filters.pyi diff --git a/python/helpers/typeshed/third_party/2and3/attr/validators.pyi b/python/helpers/typeshed/stubs/attrs/attr/validators.pyi similarity index 95% rename from python/helpers/typeshed/third_party/2and3/attr/validators.pyi rename to python/helpers/typeshed/stubs/attrs/attr/validators.pyi index 49a7cbad5758..4b235fcb0476 100644 --- a/python/helpers/typeshed/third_party/2and3/attr/validators.pyi +++ b/python/helpers/typeshed/stubs/attrs/attr/validators.pyi @@ -21,10 +21,10 @@ _T = TypeVar("_T") _T1 = TypeVar("_T1") _T2 = TypeVar("_T2") _T3 = TypeVar("_T3") -_I = TypeVar("_I", bound=Iterable) +_I = TypeVar("_I", bound=Iterable[Any]) _K = TypeVar("_K") _V = TypeVar("_V") -_M = TypeVar("_M", bound=Mapping) +_M = TypeVar("_M", bound=Mapping[Any, Any]) # To be more precise on instance_of use some overloads. # If there are more than 3 items in the tuple then we fall back to Any diff --git a/python/helpers/typeshed/stubs/cachetools/METADATA.toml b/python/helpers/typeshed/stubs/cachetools/METADATA.toml new file mode 100644 index 000000000000..31f638bf33df --- /dev/null +++ b/python/helpers/typeshed/stubs/cachetools/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +python2 = true diff --git a/python/helpers/typeshed/third_party/2and3/cachetools/__init__.pyi b/python/helpers/typeshed/stubs/cachetools/cachetools/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cachetools/__init__.pyi rename to python/helpers/typeshed/stubs/cachetools/cachetools/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cachetools/abc.pyi b/python/helpers/typeshed/stubs/cachetools/cachetools/abc.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cachetools/abc.pyi rename to python/helpers/typeshed/stubs/cachetools/cachetools/abc.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cachetools/cache.pyi b/python/helpers/typeshed/stubs/cachetools/cachetools/cache.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cachetools/cache.pyi rename to python/helpers/typeshed/stubs/cachetools/cachetools/cache.pyi diff --git a/python/helpers/typeshed/stubs/cachetools/cachetools/decorators.pyi b/python/helpers/typeshed/stubs/cachetools/cachetools/decorators.pyi new file mode 100644 index 000000000000..2c3802647488 --- /dev/null +++ b/python/helpers/typeshed/stubs/cachetools/cachetools/decorators.pyi @@ -0,0 +1,13 @@ +from typing import Any, Callable, ContextManager, MutableMapping, Optional, TypeVar + +_KT = TypeVar("_KT") +_T = TypeVar("_T", bound=Callable[..., Any]) + +def cached( + cache: Optional[MutableMapping[_KT, Any]], key: Callable[..., _KT] = ..., lock: Optional[ContextManager[Any]] = ... +) -> Callable[[_T], _T]: ... +def cachedmethod( + cache: Callable[[Any], Optional[MutableMapping[_KT, Any]]], + key: Callable[..., _KT] = ..., + lock: Optional[ContextManager[Any]] = ..., +) -> Callable[[_T], _T]: ... diff --git a/python/helpers/typeshed/third_party/2and3/cachetools/func.pyi b/python/helpers/typeshed/stubs/cachetools/cachetools/func.pyi similarity index 53% rename from python/helpers/typeshed/third_party/2and3/cachetools/func.pyi rename to python/helpers/typeshed/stubs/cachetools/cachetools/func.pyi index 04f72b94c052..1fca797738f2 100644 --- a/python/helpers/typeshed/third_party/2and3/cachetools/func.pyi +++ b/python/helpers/typeshed/stubs/cachetools/cachetools/func.pyi @@ -5,7 +5,7 @@ _T = TypeVar("_T") _F = TypeVar("_F", bound=Callable[..., Any]) _RET = Callable[[_F], _F] -def lfu_cache(maxsize: int = ..., typed: bool = ...) -> _RET: ... -def lru_cache(maxsize: int = ..., typed: bool = ...) -> _RET: ... -def rr_cache(maxsize: int = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ...) -> _RET: ... -def ttl_cache(maxsize: int = ..., ttl: float = ..., timer: float = ..., typed: bool = ...) -> _RET: ... +def lfu_cache(maxsize: int = ..., typed: bool = ...) -> _RET[_F]: ... +def lru_cache(maxsize: int = ..., typed: bool = ...) -> _RET[_F]: ... +def rr_cache(maxsize: int = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ...) -> _RET[_F]: ... +def ttl_cache(maxsize: int = ..., ttl: float = ..., timer: float = ..., typed: bool = ...) -> _RET[_F]: ... diff --git a/python/helpers/typeshed/third_party/2and3/cachetools/lfu.pyi b/python/helpers/typeshed/stubs/cachetools/cachetools/lfu.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cachetools/lfu.pyi rename to python/helpers/typeshed/stubs/cachetools/cachetools/lfu.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cachetools/lru.pyi b/python/helpers/typeshed/stubs/cachetools/cachetools/lru.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cachetools/lru.pyi rename to python/helpers/typeshed/stubs/cachetools/cachetools/lru.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cachetools/rr.pyi b/python/helpers/typeshed/stubs/cachetools/cachetools/rr.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cachetools/rr.pyi rename to python/helpers/typeshed/stubs/cachetools/cachetools/rr.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cachetools/ttl.pyi b/python/helpers/typeshed/stubs/cachetools/cachetools/ttl.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cachetools/ttl.pyi rename to python/helpers/typeshed/stubs/cachetools/cachetools/ttl.pyi diff --git a/python/helpers/typeshed/stubs/chardet/METADATA.toml b/python/helpers/typeshed/stubs/chardet/METADATA.toml new file mode 100644 index 000000000000..c2e2517588a9 --- /dev/null +++ b/python/helpers/typeshed/stubs/chardet/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +requires = ["types-typing-extensions"] diff --git a/python/helpers/typeshed/third_party/2and3/chardet/__init__.pyi b/python/helpers/typeshed/stubs/chardet/chardet/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/chardet/__init__.pyi rename to python/helpers/typeshed/stubs/chardet/chardet/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/chardet/enums.pyi b/python/helpers/typeshed/stubs/chardet/chardet/enums.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/chardet/enums.pyi rename to python/helpers/typeshed/stubs/chardet/chardet/enums.pyi diff --git a/python/helpers/typeshed/third_party/2and3/chardet/langbulgarianmodel.pyi b/python/helpers/typeshed/stubs/chardet/chardet/langbulgarianmodel.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/chardet/langbulgarianmodel.pyi rename to python/helpers/typeshed/stubs/chardet/chardet/langbulgarianmodel.pyi diff --git a/python/helpers/typeshed/third_party/2and3/chardet/langcyrillicmodel.pyi b/python/helpers/typeshed/stubs/chardet/chardet/langcyrillicmodel.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/chardet/langcyrillicmodel.pyi rename to python/helpers/typeshed/stubs/chardet/chardet/langcyrillicmodel.pyi diff --git a/python/helpers/typeshed/third_party/2and3/chardet/langgreekmodel.pyi b/python/helpers/typeshed/stubs/chardet/chardet/langgreekmodel.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/chardet/langgreekmodel.pyi rename to python/helpers/typeshed/stubs/chardet/chardet/langgreekmodel.pyi diff --git a/python/helpers/typeshed/third_party/2and3/chardet/langhebrewmodel.pyi b/python/helpers/typeshed/stubs/chardet/chardet/langhebrewmodel.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/chardet/langhebrewmodel.pyi rename to python/helpers/typeshed/stubs/chardet/chardet/langhebrewmodel.pyi diff --git a/python/helpers/typeshed/third_party/2and3/chardet/langhungarianmodel.pyi b/python/helpers/typeshed/stubs/chardet/chardet/langhungarianmodel.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/chardet/langhungarianmodel.pyi rename to python/helpers/typeshed/stubs/chardet/chardet/langhungarianmodel.pyi diff --git a/python/helpers/typeshed/third_party/2and3/chardet/langthaimodel.pyi b/python/helpers/typeshed/stubs/chardet/chardet/langthaimodel.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/chardet/langthaimodel.pyi rename to python/helpers/typeshed/stubs/chardet/chardet/langthaimodel.pyi diff --git a/python/helpers/typeshed/third_party/2and3/chardet/langturkishmodel.pyi b/python/helpers/typeshed/stubs/chardet/chardet/langturkishmodel.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/chardet/langturkishmodel.pyi rename to python/helpers/typeshed/stubs/chardet/chardet/langturkishmodel.pyi diff --git a/python/helpers/typeshed/third_party/2and3/chardet/universaldetector.pyi b/python/helpers/typeshed/stubs/chardet/chardet/universaldetector.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/chardet/universaldetector.pyi rename to python/helpers/typeshed/stubs/chardet/chardet/universaldetector.pyi diff --git a/python/helpers/typeshed/third_party/2and3/chardet/version.pyi b/python/helpers/typeshed/stubs/chardet/chardet/version.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/chardet/version.pyi rename to python/helpers/typeshed/stubs/chardet/chardet/version.pyi diff --git a/python/helpers/typeshed/stubs/click-spinner/METADATA.toml b/python/helpers/typeshed/stubs/click-spinner/METADATA.toml new file mode 100644 index 000000000000..c2e2517588a9 --- /dev/null +++ b/python/helpers/typeshed/stubs/click-spinner/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +requires = ["types-typing-extensions"] diff --git a/python/helpers/typeshed/third_party/2and3/click_spinner/__init__.pyi b/python/helpers/typeshed/stubs/click-spinner/click_spinner/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/click_spinner/__init__.pyi rename to python/helpers/typeshed/stubs/click-spinner/click_spinner/__init__.pyi diff --git a/python/helpers/typeshed/stubs/contextvars/METADATA.toml b/python/helpers/typeshed/stubs/contextvars/METADATA.toml new file mode 100644 index 000000000000..5f1541084942 --- /dev/null +++ b/python/helpers/typeshed/stubs/contextvars/METADATA.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/python/helpers/typeshed/third_party/3/contextvars.pyi b/python/helpers/typeshed/stubs/contextvars/contextvars.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/contextvars.pyi rename to python/helpers/typeshed/stubs/contextvars/contextvars.pyi diff --git a/python/helpers/typeshed/stubs/cryptography/METADATA.toml b/python/helpers/typeshed/stubs/cryptography/METADATA.toml new file mode 100644 index 000000000000..747b5650021a --- /dev/null +++ b/python/helpers/typeshed/stubs/cryptography/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +requires = ["types-enum34", "types-ipaddress"] diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/bindings/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/bindings/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/exceptions.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/exceptions.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/exceptions.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/exceptions.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/fernet.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/fernet.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/fernet.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/fernet.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/backends/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/backends/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/backends/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/backends/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/backends/interfaces.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/backends/interfaces.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/backends/interfaces.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/backends/interfaces.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/bindings/openssl/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/bindings/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/bindings/openssl/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/bindings/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/dateutil/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/bindings/openssl/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/dateutil/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/bindings/openssl/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/bindings/openssl/binding.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/bindings/openssl/binding.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/bindings/openssl/binding.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/bindings/openssl/binding.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/dh.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dh.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/dh.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dh.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/dsa.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dsa.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/dsa.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dsa.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/ec.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/ec.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/ec.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/ec.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/ed25519.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/ed25519.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/ed25519.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/ed25519.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/ed448.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/ed448.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/ed448.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/ed448.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/padding.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/padding.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/padding.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/padding.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/rsa.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/rsa.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/rsa.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/rsa.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/utils.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/utils.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/utils.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/utils.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/x25519.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/x25519.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/x25519.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/x25519.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/x448.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/x448.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/asymmetric/x448.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/asymmetric/x448.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/ciphers/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/ciphers/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/ciphers/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/ciphers/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/ciphers/aead.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/ciphers/aead.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/ciphers/aead.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/ciphers/aead.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/ciphers/algorithms.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/ciphers/algorithms.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/ciphers/algorithms.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/ciphers/algorithms.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/ciphers/modes.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/ciphers/modes.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/ciphers/modes.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/ciphers/modes.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/cmac.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/cmac.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/cmac.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/cmac.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/constant_time.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/constant_time.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/constant_time.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/constant_time.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/hashes.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/hashes.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/hashes.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/hashes.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/hmac.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/hmac.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/hmac.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/hmac.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/concatkdf.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/concatkdf.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/concatkdf.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/concatkdf.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/hkdf.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/hkdf.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/hkdf.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/hkdf.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/kbkdf.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/kbkdf.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/kbkdf.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/kbkdf.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/pbkdf2.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/pbkdf2.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/pbkdf2.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/pbkdf2.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/scrypt.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/scrypt.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/scrypt.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/scrypt.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/x963kdf.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/x963kdf.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/kdf/x963kdf.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/kdf/x963kdf.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/keywrap.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/keywrap.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/keywrap.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/keywrap.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/padding.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/padding.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/padding.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/padding.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/poly1305.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/poly1305.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/poly1305.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/poly1305.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/serialization/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/serialization/__init__.pyi similarity index 97% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/serialization/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/serialization/__init__.pyi index 93575117daa5..53ce83eea858 100644 --- a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/serialization/__init__.pyi +++ b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/serialization/__init__.pyi @@ -28,7 +28,7 @@ def load_der_public_key( data: bytes, backend: Optional[DERSerializationBackend] = ... ) -> Any: ... # actually Union[RSAPublicKey, DSAPublicKey, DHPublicKey, EllipticCurvePublicKey] def load_ssh_public_key( - data: bytes, backend: Union[RSABackend, DSABackend, EllipticCurveBackend, None] + data: bytes, backend: Union[RSABackend, DSABackend, EllipticCurveBackend, None] = ... ) -> Any: ... # actually Union[RSAPublicKey, DSAPublicKey, DHPublicKey, EllipticCurvePublicKey, Ed25519PublicKey] class Encoding(Enum): @@ -37,11 +37,13 @@ class Encoding(Enum): OpenSSH: str Raw: str X962: str + SMIME: str class PrivateFormat(Enum): PKCS8: str TraditionalOpenSSL: str Raw: str + OpenSSH: str class PublicFormat(Enum): SubjectPublicKeyInfo: str diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/serialization/pkcs12.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs12.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/serialization/pkcs12.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs12.pyi diff --git a/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi new file mode 100644 index 000000000000..582d9a74c21f --- /dev/null +++ b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/serialization/pkcs7.pyi @@ -0,0 +1,30 @@ +from enum import Enum +from typing import Any, Iterable, List, Optional, Union + +from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKey +from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey +from cryptography.hazmat.primitives.hashes import SHA1, SHA224, SHA256, SHA384, SHA512 +from cryptography.hazmat.primitives.serialization import Encoding +from cryptography.x509 import Certificate + +def load_pem_pkcs7_certificates(data: bytes) -> List[Certificate]: ... +def load_der_pkcs7_certificates(data: bytes) -> List[Certificate]: ... + +class PKCS7Options(Enum): + Text: str + Binary: str + DetachedSignature: str + NoCapabilities: str + NoAttributes: str + NoCerts: str + +class PKCS7SignatureBuilder: + def set_data(self, data: bytes) -> PKCS7SignatureBuilder: ... + def add_signer( + self, + certificate: Certificate, + private_key: Union[RSAPrivateKey, EllipticCurvePrivateKey], + hash_algorithm: Union[SHA1, SHA224, SHA256, SHA384, SHA512], + ) -> PKCS7SignatureBuilder: ... + def add_certificate(self, certificate: Certificate) -> PKCS7SignatureBuilder: ... + def sign(self, encoding: Encoding, options: Iterable[PKCS7Options], backend: Optional[Any] = ...) -> bytes: ... diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/twofactor/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/twofactor/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/twofactor/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/twofactor/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/twofactor/hotp.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/twofactor/hotp.pyi similarity index 70% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/twofactor/hotp.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/twofactor/hotp.pyi index e83c3ac921e0..c1e5607e0947 100644 --- a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/twofactor/hotp.pyi +++ b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/twofactor/hotp.pyi @@ -5,7 +5,12 @@ from cryptography.hazmat.primitives.hashes import HashAlgorithm class HOTP(object): def __init__( - self, key: bytes, length: int, algorithm: HashAlgorithm, backend: HMACBackend, enforce_key_length: bool = ... + self, + key: bytes, + length: int, + algorithm: HashAlgorithm, + backend: Optional[HMACBackend] = ..., + enforce_key_length: bool = ..., ): ... def generate(self, counter: int) -> bytes: ... def get_provisioning_uri(self, account_name: str, counter: int, issuer: Optional[str]) -> str: ... diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/twofactor/totp.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyi similarity index 92% rename from python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/twofactor/totp.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyi index 306bfe1c1362..1525910879ba 100644 --- a/python/helpers/typeshed/third_party/2and3/cryptography/hazmat/primitives/twofactor/totp.pyi +++ b/python/helpers/typeshed/stubs/cryptography/cryptography/hazmat/primitives/twofactor/totp.pyi @@ -10,7 +10,7 @@ class TOTP(object): length: int, algorithm: HashAlgorithm, time_step: int, - backend: HMACBackend, + backend: Optional[HMACBackend] = ..., enforce_key_length: bool = ..., ): ... def generate(self, time: int) -> bytes: ... diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/x509/__init__.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/x509/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/x509/__init__.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/x509/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/x509/extensions.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/x509/extensions.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/x509/extensions.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/x509/extensions.pyi diff --git a/python/helpers/typeshed/third_party/2and3/cryptography/x509/oid.pyi b/python/helpers/typeshed/stubs/cryptography/cryptography/x509/oid.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/cryptography/x509/oid.pyi rename to python/helpers/typeshed/stubs/cryptography/cryptography/x509/oid.pyi diff --git a/python/helpers/typeshed/stubs/enum34/METADATA.toml b/python/helpers/typeshed/stubs/enum34/METADATA.toml new file mode 100644 index 000000000000..ea72961c9ac7 --- /dev/null +++ b/python/helpers/typeshed/stubs/enum34/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +python3 = false diff --git a/python/helpers/typeshed/stubs/enum34/enum.pyi b/python/helpers/typeshed/stubs/enum34/enum.pyi new file mode 100644 index 000000000000..4bc061d1c440 --- /dev/null +++ b/python/helpers/typeshed/stubs/enum34/enum.pyi @@ -0,0 +1,73 @@ +import sys +from abc import ABCMeta +from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union + +_T = TypeVar("_T") +_S = TypeVar("_S", bound=Type[Enum]) + +# Note: EnumMeta actually subclasses type directly, not ABCMeta. +# This is a temporary workaround to allow multiple creation of enums with builtins +# such as str as mixins, which due to the handling of ABCs of builtin types, cause +# spurious inconsistent metaclass structure. See #1595. +# Structurally: Iterable[T], Reversible[T], Container[T] where T is the enum itself +class EnumMeta(ABCMeta): + def __iter__(self: Type[_T]) -> Iterator[_T]: ... + def __reversed__(self: Type[_T]) -> Iterator[_T]: ... + def __contains__(self, member: object) -> bool: ... + def __getitem__(self: Type[_T], name: str) -> _T: ... + @property + def __members__(self: Type[_T]) -> Mapping[str, _T]: ... + def __len__(self) -> int: ... + +class Enum(metaclass=EnumMeta): + name: str + value: Any + _name_: str + _value_: Any + _member_names_: List[str] # undocumented + _member_map_: Dict[str, Enum] # undocumented + _value2member_map_: Dict[int, Enum] # undocumented + if sys.version_info >= (3, 7): + _ignore_: Union[str, List[str]] + _order_: str + __order__: str + @classmethod + def _missing_(cls, value: object) -> Any: ... + @staticmethod + def _generate_next_value_(name: str, start: int, count: int, last_values: List[Any]) -> Any: ... + def __new__(cls: Type[_T], value: object) -> _T: ... + def __repr__(self) -> str: ... + def __str__(self) -> str: ... + def __dir__(self) -> List[str]: ... + def __format__(self, format_spec: str) -> str: ... + def __hash__(self) -> Any: ... + def __reduce_ex__(self, proto: object) -> Any: ... + +class IntEnum(int, Enum): + value: int + +def unique(enumeration: _S) -> _S: ... + +_auto_null: Any + +# subclassing IntFlag so it picks up all implemented base functions, best modeling behavior of enum.auto() +class auto(IntFlag): + value: Any + +class Flag(Enum): + def __contains__(self: _T, other: _T) -> bool: ... + def __repr__(self) -> str: ... + def __str__(self) -> str: ... + def __bool__(self) -> bool: ... + def __or__(self: _T, other: _T) -> _T: ... + def __and__(self: _T, other: _T) -> _T: ... + def __xor__(self: _T, other: _T) -> _T: ... + def __invert__(self: _T) -> _T: ... + +class IntFlag(int, Flag): + def __or__(self: _T, other: Union[int, _T]) -> _T: ... + def __and__(self: _T, other: Union[int, _T]) -> _T: ... + def __xor__(self: _T, other: Union[int, _T]) -> _T: ... + __ror__ = __or__ + __rand__ = __and__ + __rxor__ = __xor__ diff --git a/python/helpers/typeshed/stubs/filelock/METADATA.toml b/python/helpers/typeshed/stubs/filelock/METADATA.toml new file mode 100644 index 000000000000..5f1541084942 --- /dev/null +++ b/python/helpers/typeshed/stubs/filelock/METADATA.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/python/helpers/typeshed/third_party/3/filelock/__init__.pyi b/python/helpers/typeshed/stubs/filelock/filelock/__init__.pyi similarity index 99% rename from python/helpers/typeshed/third_party/3/filelock/__init__.pyi rename to python/helpers/typeshed/stubs/filelock/filelock/__init__.pyi index 84a648f432e5..5d5fcc235b5c 100644 --- a/python/helpers/typeshed/third_party/3/filelock/__init__.pyi +++ b/python/helpers/typeshed/stubs/filelock/filelock/__init__.pyi @@ -23,7 +23,7 @@ class BaseFileLock: @property def timeout(self) -> float: ... @timeout.setter - def timeout(self, value: Union[int, str, float]) -> None: ... + def timeout(self, value: Union[int, str, float]) -> None: ... # type: ignore @property def is_locked(self) -> bool: ... def acquire(self, timeout: Optional[float] = ..., poll_intervall: float = ...) -> _Acquire_ReturnProxy: ... diff --git a/python/helpers/typeshed/stubs/freezegun/METADATA.toml b/python/helpers/typeshed/stubs/freezegun/METADATA.toml new file mode 100644 index 000000000000..5f1541084942 --- /dev/null +++ b/python/helpers/typeshed/stubs/freezegun/METADATA.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/python/helpers/typeshed/third_party/3/freezegun/__init__.pyi b/python/helpers/typeshed/stubs/freezegun/freezegun/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/freezegun/__init__.pyi rename to python/helpers/typeshed/stubs/freezegun/freezegun/__init__.pyi diff --git a/python/helpers/typeshed/third_party/3/freezegun/api.pyi b/python/helpers/typeshed/stubs/freezegun/freezegun/api.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/freezegun/api.pyi rename to python/helpers/typeshed/stubs/freezegun/freezegun/api.pyi diff --git a/python/helpers/typeshed/stubs/frozendict/METADATA.toml b/python/helpers/typeshed/stubs/frozendict/METADATA.toml new file mode 100644 index 000000000000..5f1541084942 --- /dev/null +++ b/python/helpers/typeshed/stubs/frozendict/METADATA.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/python/helpers/typeshed/third_party/3/frozendict.pyi b/python/helpers/typeshed/stubs/frozendict/frozendict.pyi similarity index 84% rename from python/helpers/typeshed/third_party/3/frozendict.pyi rename to python/helpers/typeshed/stubs/frozendict/frozendict.pyi index 704a44c135c8..d8c349de22ed 100644 --- a/python/helpers/typeshed/third_party/3/frozendict.pyi +++ b/python/helpers/typeshed/stubs/frozendict/frozendict.pyi @@ -7,7 +7,7 @@ _VT = TypeVar("_VT") class frozendict(Mapping[_KT, _VT], Generic[_KT, _VT]): - dict_cls: Type[Dict] = ... + dict_cls: Type[Dict[Any, Any]] = ... @overload def __init__(self, **kwargs: _VT) -> None: ... @overload @@ -22,6 +22,6 @@ class frozendict(Mapping[_KT, _VT], Generic[_KT, _VT]): def __repr__(self) -> str: ... def __hash__(self) -> int: ... -class FrozenOrderedDict(frozendict): +class FrozenOrderedDict(frozendict[_KT, _VT]): - dict_cls: Type[collections.OrderedDict] = ... + dict_cls: Type[collections.OrderedDict[Any, Any]] = ... diff --git a/python/helpers/typeshed/stubs/futures/METADATA.toml b/python/helpers/typeshed/stubs/futures/METADATA.toml new file mode 100644 index 000000000000..ea72961c9ac7 --- /dev/null +++ b/python/helpers/typeshed/stubs/futures/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +python3 = false diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/contrib/__init__.pyi b/python/helpers/typeshed/stubs/futures/concurrent/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/contrib/__init__.pyi rename to python/helpers/typeshed/stubs/futures/concurrent/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2/concurrent/futures/__init__.pyi b/python/helpers/typeshed/stubs/futures/concurrent/futures/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/concurrent/futures/__init__.pyi rename to python/helpers/typeshed/stubs/futures/concurrent/futures/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2/concurrent/futures/_base.pyi b/python/helpers/typeshed/stubs/futures/concurrent/futures/_base.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/concurrent/futures/_base.pyi rename to python/helpers/typeshed/stubs/futures/concurrent/futures/_base.pyi diff --git a/python/helpers/typeshed/third_party/2/concurrent/futures/process.pyi b/python/helpers/typeshed/stubs/futures/concurrent/futures/process.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/concurrent/futures/process.pyi rename to python/helpers/typeshed/stubs/futures/concurrent/futures/process.pyi diff --git a/python/helpers/typeshed/third_party/2/concurrent/futures/thread.pyi b/python/helpers/typeshed/stubs/futures/concurrent/futures/thread.pyi similarity index 95% rename from python/helpers/typeshed/third_party/2/concurrent/futures/thread.pyi rename to python/helpers/typeshed/stubs/futures/concurrent/futures/thread.pyi index fa5720024cfb..6e272f38dde9 100644 --- a/python/helpers/typeshed/third_party/2/concurrent/futures/thread.pyi +++ b/python/helpers/typeshed/stubs/futures/concurrent/futures/thread.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Generic, Iterable, Mapping, Optional, Tuple, TypeVar +from typing import Any, Callable, Generic, Iterable, Mapping, Optional, TypeVar from ._base import Executor, Future diff --git a/python/helpers/typeshed/stubs/ipaddress/METADATA.toml b/python/helpers/typeshed/stubs/ipaddress/METADATA.toml new file mode 100644 index 000000000000..ea72961c9ac7 --- /dev/null +++ b/python/helpers/typeshed/stubs/ipaddress/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +python3 = false diff --git a/python/helpers/typeshed/third_party/2/ipaddress.pyi b/python/helpers/typeshed/stubs/ipaddress/ipaddress.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/ipaddress.pyi rename to python/helpers/typeshed/stubs/ipaddress/ipaddress.pyi diff --git a/python/helpers/typeshed/stubs/mock/METADATA.toml b/python/helpers/typeshed/stubs/mock/METADATA.toml new file mode 100644 index 000000000000..31f638bf33df --- /dev/null +++ b/python/helpers/typeshed/stubs/mock/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +python2 = true diff --git a/python/helpers/typeshed/third_party/2and3/mock.pyi b/python/helpers/typeshed/stubs/mock/mock.pyi similarity index 99% rename from python/helpers/typeshed/third_party/2and3/mock.pyi rename to python/helpers/typeshed/stubs/mock/mock.pyi index 013a22a2d570..4e02c5f06b33 100644 --- a/python/helpers/typeshed/third_party/2and3/mock.pyi +++ b/python/helpers/typeshed/stubs/mock/mock.pyi @@ -390,7 +390,7 @@ if sys.version_info >= (3, 8): def assert_any_await(self, *args: Any, **kwargs: Any) -> None: ... def assert_has_awaits(self, calls: _CallList, any_order: bool = ...) -> None: ... def assert_not_awaited(self) -> None: ... - def reset_mock(self, *args, **kwargs) -> None: ... + def reset_mock(self, *args: Any, **kwargs: Any) -> None: ... await_count: int await_args: Optional[_Call] await_args_list: _CallList diff --git a/python/helpers/typeshed/stubs/nmap/METADATA.toml b/python/helpers/typeshed/stubs/nmap/METADATA.toml new file mode 100644 index 000000000000..c2e2517588a9 --- /dev/null +++ b/python/helpers/typeshed/stubs/nmap/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +requires = ["types-typing-extensions"] diff --git a/python/helpers/typeshed/third_party/2and3/nmap/__init__.pyi b/python/helpers/typeshed/stubs/nmap/nmap/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/nmap/__init__.pyi rename to python/helpers/typeshed/stubs/nmap/nmap/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/nmap/nmap.pyi b/python/helpers/typeshed/stubs/nmap/nmap/nmap.pyi similarity index 96% rename from python/helpers/typeshed/third_party/2and3/nmap/nmap.pyi rename to python/helpers/typeshed/stubs/nmap/nmap/nmap.pyi index bcf8ed96ed31..5e4be5adca24 100644 --- a/python/helpers/typeshed/third_party/2and3/nmap/nmap.pyi +++ b/python/helpers/typeshed/stubs/nmap/nmap/nmap.pyi @@ -70,7 +70,9 @@ class PortScanner(object): def has_host(self, host: str) -> bool: ... def csv(self) -> str: ... -def __scan_progressive__(self, hosts: Text, ports: Text, arguments: Text, callback: Optional[_Callback], sudo: bool) -> None: ... +def __scan_progressive__( + self: object, hosts: Text, ports: Text, arguments: Text, callback: Optional[_Callback], sudo: bool +) -> None: ... class PortScannerAsync(object): def __init__(self) -> None: ... diff --git a/python/helpers/typeshed/stubs/orjson/METADATA.toml b/python/helpers/typeshed/stubs/orjson/METADATA.toml new file mode 100644 index 000000000000..5f1541084942 --- /dev/null +++ b/python/helpers/typeshed/stubs/orjson/METADATA.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/python/helpers/typeshed/third_party/3/orjson.pyi b/python/helpers/typeshed/stubs/orjson/orjson.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/orjson.pyi rename to python/helpers/typeshed/stubs/orjson/orjson.pyi diff --git a/python/helpers/typeshed/stubs/paramiko/METADATA.toml b/python/helpers/typeshed/stubs/paramiko/METADATA.toml new file mode 100644 index 000000000000..a96fdbca67ee --- /dev/null +++ b/python/helpers/typeshed/stubs/paramiko/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +requires = ["types-cryptography"] diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/__init__.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/__init__.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/_version.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/_version.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/_version.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/_version.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/_winapi.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/_winapi.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/_winapi.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/_winapi.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/agent.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/agent.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/agent.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/agent.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/auth_handler.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/auth_handler.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/auth_handler.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/auth_handler.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/ber.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/ber.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/ber.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/ber.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/buffered_pipe.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/buffered_pipe.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/buffered_pipe.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/buffered_pipe.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/channel.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/channel.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/channel.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/channel.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/client.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/client.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/client.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/client.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/common.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/common.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/common.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/common.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/compress.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/compress.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/compress.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/compress.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/config.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/config.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/config.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/config.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/dsskey.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/dsskey.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/dsskey.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/dsskey.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/ecdsakey.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/ecdsakey.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/ecdsakey.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/ecdsakey.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/ed25519key.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/ed25519key.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/ed25519key.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/ed25519key.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/file.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/file.pyi similarity index 95% rename from python/helpers/typeshed/third_party/2and3/paramiko/file.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/file.pyi index 112b38d83a39..e462f1fa0254 100644 --- a/python/helpers/typeshed/third_party/2and3/paramiko/file.pyi +++ b/python/helpers/typeshed/stubs/paramiko/paramiko/file.pyi @@ -26,7 +26,7 @@ class BufferedFile(ClosingContextManager, Generic[AnyStr]): def writable(self) -> bool: ... def seekable(self) -> bool: ... def readinto(self, buff: bytearray) -> int: ... - def read(self, size: Optional[int] = ...) -> AnyStr: ... + def read(self, size: Optional[int] = ...) -> bytes: ... def readline(self, size: Optional[int] = ...) -> AnyStr: ... def readlines(self, sizehint: Optional[int] = ...) -> List[AnyStr]: ... def seek(self, offset: int, whence: int = ...) -> None: ... diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/hostkeys.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/hostkeys.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/hostkeys.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/hostkeys.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/kex_curve25519.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/kex_curve25519.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/kex_curve25519.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/kex_curve25519.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/kex_ecdh_nist.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/kex_ecdh_nist.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/kex_ecdh_nist.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/kex_ecdh_nist.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/kex_gex.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/kex_gex.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/kex_gex.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/kex_gex.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/kex_group1.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/kex_group1.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/kex_group1.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/kex_group1.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/kex_group14.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/kex_group14.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/kex_group14.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/kex_group14.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/kex_group16.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/kex_group16.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/kex_group16.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/kex_group16.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/kex_gss.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/kex_gss.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/kex_gss.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/kex_gss.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/message.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/message.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/message.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/message.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/packet.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/packet.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/packet.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/packet.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/pipe.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/pipe.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/pipe.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/pipe.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/pkey.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/pkey.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/pkey.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/pkey.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/primes.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/primes.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/primes.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/primes.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/proxy.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/proxy.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/proxy.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/proxy.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/py3compat.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/py3compat.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/py3compat.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/py3compat.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/rsakey.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/rsakey.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/rsakey.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/rsakey.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/server.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/server.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/server.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/server.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/sftp.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/sftp.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/sftp.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/sftp.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/sftp_attr.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/sftp_attr.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/sftp_attr.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/sftp_attr.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/sftp_client.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/sftp_client.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/sftp_client.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/sftp_client.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/sftp_file.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/sftp_file.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/sftp_file.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/sftp_file.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/sftp_handle.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/sftp_handle.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/sftp_handle.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/sftp_handle.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/sftp_server.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/sftp_server.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/sftp_server.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/sftp_server.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/sftp_si.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/sftp_si.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/sftp_si.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/sftp_si.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/ssh_exception.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/ssh_exception.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/ssh_exception.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/ssh_exception.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/ssh_gss.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/ssh_gss.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/ssh_gss.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/ssh_gss.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/transport.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/transport.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/transport.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/transport.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/util.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/util.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/util.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/util.pyi diff --git a/python/helpers/typeshed/third_party/2and3/paramiko/win_pageant.pyi b/python/helpers/typeshed/stubs/paramiko/paramiko/win_pageant.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/paramiko/win_pageant.pyi rename to python/helpers/typeshed/stubs/paramiko/paramiko/win_pageant.pyi diff --git a/python/helpers/typeshed/stubs/pathlib2/METADATA.toml b/python/helpers/typeshed/stubs/pathlib2/METADATA.toml new file mode 100644 index 000000000000..68d729169094 --- /dev/null +++ b/python/helpers/typeshed/stubs/pathlib2/METADATA.toml @@ -0,0 +1,4 @@ +version = "0.1" +python2 = true +python3 = false +requires = ["types-typing-extensions"] diff --git a/python/helpers/typeshed/third_party/2/pathlib2.pyi b/python/helpers/typeshed/stubs/pathlib2/pathlib2.pyi similarity index 80% rename from python/helpers/typeshed/third_party/2/pathlib2.pyi rename to python/helpers/typeshed/stubs/pathlib2/pathlib2.pyi index ce9bbc1d4939..acd60295d6d3 100644 --- a/python/helpers/typeshed/third_party/2/pathlib2.pyi +++ b/python/helpers/typeshed/stubs/pathlib2/pathlib2.pyi @@ -1,15 +1,10 @@ import os -import sys -from _typeshed import OpenBinaryMode, OpenBinaryModeReading, OpenBinaryModeUpdating, OpenBinaryModeWriting, OpenTextMode -from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper from types import TracebackType -from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, Text, TextIO, Tuple, Type, TypeVar, Union, overload -from typing_extensions import Literal +from typing import IO, Any, Generator, List, Optional, Sequence, Text, Tuple, Type, TypeVar, Union _P = TypeVar("_P", bound=PurePath) _PurePathBase = object -_PathLike = PurePath class PurePath(_PurePathBase): parts: Tuple[str, ...] @@ -20,14 +15,14 @@ class PurePath(_PurePathBase): suffix: str suffixes: List[str] stem: str - def __new__(cls: Type[_P], *args: Union[str, _PathLike]) -> _P: ... + def __new__(cls: Type[_P], *args: Union[str, PurePath]) -> _P: ... def __hash__(self) -> int: ... def __lt__(self, other: PurePath) -> bool: ... def __le__(self, other: PurePath) -> bool: ... def __gt__(self, other: PurePath) -> bool: ... def __ge__(self, other: PurePath) -> bool: ... - def __truediv__(self: _P, key: Union[str, _PathLike]) -> _P: ... - def __rtruediv__(self: _P, key: Union[str, _PathLike]) -> _P: ... + def __truediv__(self: _P, key: Union[str, PurePath]) -> _P: ... + def __rtruediv__(self: _P, key: Union[str, PurePath]) -> _P: ... def __div__(self: _P, key: Union[str, PurePath]) -> _P: ... def __bytes__(self) -> bytes: ... def as_posix(self) -> str: ... @@ -35,10 +30,10 @@ class PurePath(_PurePathBase): def is_absolute(self) -> bool: ... def is_reserved(self) -> bool: ... def match(self, path_pattern: str) -> bool: ... - def relative_to(self: _P, *other: Union[str, _PathLike]) -> _P: ... + def relative_to(self: _P, *other: Union[str, PurePath]) -> _P: ... def with_name(self: _P, name: str) -> _P: ... def with_suffix(self: _P, suffix: str) -> _P: ... - def joinpath(self: _P, *other: Union[str, _PathLike]) -> _P: ... + def joinpath(self: _P, *other: Union[str, PurePath]) -> _P: ... @property def parents(self: _P) -> Sequence[_P]: ... @property @@ -48,7 +43,7 @@ class PurePosixPath(PurePath): ... class PureWindowsPath(PurePath): ... class Path(PurePath): - def __new__(cls: Type[_P], *args: Union[str, _PathLike], **kwargs: Any) -> _P: ... + def __new__(cls: Type[_P], *args: Union[str, PurePath], **kwargs: Any) -> _P: ... def __enter__(self) -> Path: ... def __exit__( self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType] diff --git a/python/helpers/typeshed/stubs/pkg_resources/METADATA.toml b/python/helpers/typeshed/stubs/pkg_resources/METADATA.toml new file mode 100644 index 000000000000..5f1541084942 --- /dev/null +++ b/python/helpers/typeshed/stubs/pkg_resources/METADATA.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/python/helpers/typeshed/third_party/3/pkg_resources/__init__.pyi b/python/helpers/typeshed/stubs/pkg_resources/pkg_resources/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/pkg_resources/__init__.pyi rename to python/helpers/typeshed/stubs/pkg_resources/pkg_resources/__init__.pyi diff --git a/python/helpers/typeshed/third_party/3/pkg_resources/py31compat.pyi b/python/helpers/typeshed/stubs/pkg_resources/pkg_resources/py31compat.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/pkg_resources/py31compat.pyi rename to python/helpers/typeshed/stubs/pkg_resources/pkg_resources/py31compat.pyi diff --git a/python/helpers/typeshed/stubs/polib/METADATA.toml b/python/helpers/typeshed/stubs/polib/METADATA.toml new file mode 100644 index 000000000000..31f638bf33df --- /dev/null +++ b/python/helpers/typeshed/stubs/polib/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +python2 = true diff --git a/python/helpers/typeshed/third_party/2and3/polib.pyi b/python/helpers/typeshed/stubs/polib/polib.pyi similarity index 98% rename from python/helpers/typeshed/third_party/2and3/polib.pyi rename to python/helpers/typeshed/stubs/polib/polib.pyi index 4f5d0c992011..85f43669d922 100644 --- a/python/helpers/typeshed/third_party/2and3/polib.pyi +++ b/python/helpers/typeshed/stubs/polib/polib.pyi @@ -42,7 +42,7 @@ class _BaseFile(List[_TB]): def ordered_metadata(self) -> List[Text]: ... def to_binary(self) -> bytes: ... -class POFile(_BaseFile): +class POFile(_BaseFile[POEntry]): def __unicode__(self) -> Text: ... def save_as_mofile(self, fpath: Text) -> None: ... def percent_translated(self) -> int: ... @@ -52,7 +52,7 @@ class POFile(_BaseFile): def obsolete_entries(self) -> List[POEntry]: ... def merge(self, refpot: POFile) -> None: ... -class MOFile(_BaseFile): +class MOFile(_BaseFile[MOEntry]): MAGIC: int MAGIC_SWAPPED: int magic_number: Optional[int] diff --git a/python/helpers/typeshed/stubs/pyRFC3339/METADATA.toml b/python/helpers/typeshed/stubs/pyRFC3339/METADATA.toml new file mode 100644 index 000000000000..5f1541084942 --- /dev/null +++ b/python/helpers/typeshed/stubs/pyRFC3339/METADATA.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/python/helpers/typeshed/third_party/3/pyrfc3339/__init__.pyi b/python/helpers/typeshed/stubs/pyRFC3339/pyrfc3339/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/pyrfc3339/__init__.pyi rename to python/helpers/typeshed/stubs/pyRFC3339/pyrfc3339/__init__.pyi diff --git a/python/helpers/typeshed/third_party/3/pyrfc3339/generator.pyi b/python/helpers/typeshed/stubs/pyRFC3339/pyrfc3339/generator.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/pyrfc3339/generator.pyi rename to python/helpers/typeshed/stubs/pyRFC3339/pyrfc3339/generator.pyi diff --git a/python/helpers/typeshed/third_party/3/pyrfc3339/parser.pyi b/python/helpers/typeshed/stubs/pyRFC3339/pyrfc3339/parser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/pyrfc3339/parser.pyi rename to python/helpers/typeshed/stubs/pyRFC3339/pyrfc3339/parser.pyi diff --git a/python/helpers/typeshed/third_party/3/pyrfc3339/utils.pyi b/python/helpers/typeshed/stubs/pyRFC3339/pyrfc3339/utils.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/pyrfc3339/utils.pyi rename to python/helpers/typeshed/stubs/pyRFC3339/pyrfc3339/utils.pyi diff --git a/python/helpers/typeshed/stubs/python-dateutil/METADATA.toml b/python/helpers/typeshed/stubs/python-dateutil/METADATA.toml new file mode 100644 index 000000000000..c2e2517588a9 --- /dev/null +++ b/python/helpers/typeshed/stubs/python-dateutil/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +requires = ["types-typing-extensions"] diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/packages/__init__.pyi b/python/helpers/typeshed/stubs/python-dateutil/dateutil/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/packages/__init__.pyi rename to python/helpers/typeshed/stubs/python-dateutil/dateutil/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/dateutil/_common.pyi b/python/helpers/typeshed/stubs/python-dateutil/dateutil/_common.pyi similarity index 85% rename from python/helpers/typeshed/third_party/2and3/dateutil/_common.pyi rename to python/helpers/typeshed/stubs/python-dateutil/dateutil/_common.pyi index 0a6d8e00833f..c8326dbb989a 100644 --- a/python/helpers/typeshed/third_party/2and3/dateutil/_common.pyi +++ b/python/helpers/typeshed/stubs/python-dateutil/dateutil/_common.pyi @@ -5,7 +5,7 @@ _T = TypeVar("_T") class weekday(object): def __init__(self, weekday: int, n: Optional[int] = ...) -> None: ... def __call__(self: _T, n: int) -> _T: ... - def __eq__(self, other) -> bool: ... + def __eq__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __hash__(self) -> int: ... weekday: int diff --git a/python/helpers/typeshed/third_party/2and3/dateutil/easter.pyi b/python/helpers/typeshed/stubs/python-dateutil/dateutil/easter.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/dateutil/easter.pyi rename to python/helpers/typeshed/stubs/python-dateutil/dateutil/easter.pyi diff --git a/python/helpers/typeshed/third_party/2and3/dateutil/parser.pyi b/python/helpers/typeshed/stubs/python-dateutil/dateutil/parser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/dateutil/parser.pyi rename to python/helpers/typeshed/stubs/python-dateutil/dateutil/parser.pyi diff --git a/python/helpers/typeshed/third_party/2and3/dateutil/relativedelta.pyi b/python/helpers/typeshed/stubs/python-dateutil/dateutil/relativedelta.pyi similarity index 98% rename from python/helpers/typeshed/third_party/2and3/dateutil/relativedelta.pyi rename to python/helpers/typeshed/stubs/python-dateutil/dateutil/relativedelta.pyi index a0de3e7fd549..d8cfe61c300c 100644 --- a/python/helpers/typeshed/third_party/2and3/dateutil/relativedelta.pyi +++ b/python/helpers/typeshed/stubs/python-dateutil/dateutil/relativedelta.pyi @@ -88,7 +88,7 @@ class relativedelta(object): def __nonzero__(self) -> bool: ... def __mul__(self: _SelfT, other: SupportsFloat) -> _SelfT: ... def __rmul__(self: _SelfT, other: SupportsFloat) -> _SelfT: ... - def __eq__(self, other) -> bool: ... + def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... def __div__(self: _SelfT, other: SupportsFloat) -> _SelfT: ... def __truediv__(self: _SelfT, other: SupportsFloat) -> _SelfT: ... diff --git a/python/helpers/typeshed/third_party/2and3/dateutil/rrule.pyi b/python/helpers/typeshed/stubs/python-dateutil/dateutil/rrule.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/dateutil/rrule.pyi rename to python/helpers/typeshed/stubs/python-dateutil/dateutil/rrule.pyi diff --git a/python/helpers/typeshed/third_party/2and3/dateutil/tz/__init__.pyi b/python/helpers/typeshed/stubs/python-dateutil/dateutil/tz/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/dateutil/tz/__init__.pyi rename to python/helpers/typeshed/stubs/python-dateutil/dateutil/tz/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/dateutil/tz/_common.pyi b/python/helpers/typeshed/stubs/python-dateutil/dateutil/tz/_common.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/dateutil/tz/_common.pyi rename to python/helpers/typeshed/stubs/python-dateutil/dateutil/tz/_common.pyi diff --git a/python/helpers/typeshed/third_party/2and3/dateutil/tz/tz.pyi b/python/helpers/typeshed/stubs/python-dateutil/dateutil/tz/tz.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/dateutil/tz/tz.pyi rename to python/helpers/typeshed/stubs/python-dateutil/dateutil/tz/tz.pyi diff --git a/python/helpers/typeshed/third_party/2and3/dateutil/utils.pyi b/python/helpers/typeshed/stubs/python-dateutil/dateutil/utils.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/dateutil/utils.pyi rename to python/helpers/typeshed/stubs/python-dateutil/dateutil/utils.pyi diff --git a/python/helpers/typeshed/stubs/python-gflags/METADATA.toml b/python/helpers/typeshed/stubs/python-gflags/METADATA.toml new file mode 100644 index 000000000000..31f638bf33df --- /dev/null +++ b/python/helpers/typeshed/stubs/python-gflags/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +python2 = true diff --git a/python/helpers/typeshed/third_party/2and3/gflags.pyi b/python/helpers/typeshed/stubs/python-gflags/gflags.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/gflags.pyi rename to python/helpers/typeshed/stubs/python-gflags/gflags.pyi diff --git a/python/helpers/typeshed/stubs/python-slugify/METADATA.toml b/python/helpers/typeshed/stubs/python-slugify/METADATA.toml new file mode 100644 index 000000000000..31f638bf33df --- /dev/null +++ b/python/helpers/typeshed/stubs/python-slugify/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +python2 = true diff --git a/python/helpers/typeshed/third_party/2and3/slugify/__init__.pyi b/python/helpers/typeshed/stubs/python-slugify/slugify/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/slugify/__init__.pyi rename to python/helpers/typeshed/stubs/python-slugify/slugify/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/slugify/slugify.pyi b/python/helpers/typeshed/stubs/python-slugify/slugify/slugify.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/slugify/slugify.pyi rename to python/helpers/typeshed/stubs/python-slugify/slugify/slugify.pyi diff --git a/python/helpers/typeshed/third_party/2and3/slugify/special.pyi b/python/helpers/typeshed/stubs/python-slugify/slugify/special.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/slugify/special.pyi rename to python/helpers/typeshed/stubs/python-slugify/slugify/special.pyi diff --git a/python/helpers/typeshed/stubs/requests/METADATA.toml b/python/helpers/typeshed/stubs/requests/METADATA.toml new file mode 100644 index 000000000000..31f638bf33df --- /dev/null +++ b/python/helpers/typeshed/stubs/requests/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +python2 = true diff --git a/python/helpers/typeshed/third_party/2and3/requests/__init__.pyi b/python/helpers/typeshed/stubs/requests/requests/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/__init__.pyi rename to python/helpers/typeshed/stubs/requests/requests/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/adapters.pyi b/python/helpers/typeshed/stubs/requests/requests/adapters.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/adapters.pyi rename to python/helpers/typeshed/stubs/requests/requests/adapters.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/api.pyi b/python/helpers/typeshed/stubs/requests/requests/api.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/api.pyi rename to python/helpers/typeshed/stubs/requests/requests/api.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/auth.pyi b/python/helpers/typeshed/stubs/requests/requests/auth.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/auth.pyi rename to python/helpers/typeshed/stubs/requests/requests/auth.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/compat.pyi b/python/helpers/typeshed/stubs/requests/requests/compat.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/compat.pyi rename to python/helpers/typeshed/stubs/requests/requests/compat.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/cookies.pyi b/python/helpers/typeshed/stubs/requests/requests/cookies.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/cookies.pyi rename to python/helpers/typeshed/stubs/requests/requests/cookies.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/exceptions.pyi b/python/helpers/typeshed/stubs/requests/requests/exceptions.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/exceptions.pyi rename to python/helpers/typeshed/stubs/requests/requests/exceptions.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/hooks.pyi b/python/helpers/typeshed/stubs/requests/requests/hooks.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/hooks.pyi rename to python/helpers/typeshed/stubs/requests/requests/hooks.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/models.pyi b/python/helpers/typeshed/stubs/requests/requests/models.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/models.pyi rename to python/helpers/typeshed/stubs/requests/requests/models.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/__init__.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/__init__.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/__init__.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/__init__.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/_collections.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/_collections.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/_collections.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/_collections.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/connection.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/connection.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/connection.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/connection.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/connectionpool.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/connectionpool.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/connectionpool.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/connectionpool.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/contrib/__init__.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/contrib/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/contrib/__init__.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/contrib/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/exceptions.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/exceptions.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/exceptions.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/exceptions.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/fields.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/fields.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/fields.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/fields.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/filepost.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/filepost.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/filepost.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/filepost.pyi diff --git a/python/helpers/typeshed/third_party/2and3/werkzeug/middleware/__init__.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/packages/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/werkzeug/middleware/__init__.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/packages/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/poolmanager.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/poolmanager.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/poolmanager.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/poolmanager.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/request.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/request.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/request.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/request.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/response.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/response.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/response.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/response.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/__init__.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/__init__.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/connection.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/connection.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/connection.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/connection.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/request.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/request.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/request.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/request.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/response.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/response.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/response.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/response.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/retry.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/retry.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/retry.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/retry.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/ssl_.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/ssl_.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/ssl_.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/ssl_.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/timeout.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/timeout.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/timeout.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/timeout.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/url.pyi b/python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/url.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/packages/urllib3/util/url.pyi rename to python/helpers/typeshed/stubs/requests/requests/packages/urllib3/util/url.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/sessions.pyi b/python/helpers/typeshed/stubs/requests/requests/sessions.pyi similarity index 98% rename from python/helpers/typeshed/third_party/2and3/requests/sessions.pyi rename to python/helpers/typeshed/stubs/requests/requests/sessions.pyi index 700b711edc00..07620545456a 100644 --- a/python/helpers/typeshed/third_party/2and3/requests/sessions.pyi +++ b/python/helpers/typeshed/stubs/requests/requests/sessions.pyi @@ -50,7 +50,7 @@ _HooksInput = MutableMapping[Text, Union[Iterable[_Hook], _Hook]] class Session(SessionRedirectMixin): __attrs__: Any headers: CaseInsensitiveDict[Text] - auth: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[Request], Request]] + auth: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[PreparedRequest], PreparedRequest]] proxies: MutableMapping[Text, Text] hooks: _Hooks params: Union[bytes, MutableMapping[Text, Text]] @@ -75,7 +75,7 @@ class Session(SessionRedirectMixin): headers: Optional[MutableMapping[Text, Text]] = ..., cookies: Union[None, RequestsCookieJar, MutableMapping[Text, Text]] = ..., files: Optional[MutableMapping[Text, IO[Any]]] = ..., - auth: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[Request], Request]] = ..., + auth: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[PreparedRequest], PreparedRequest]] = ..., timeout: Union[None, float, Tuple[float, float], Tuple[float, None]] = ..., allow_redirects: Optional[bool] = ..., proxies: Optional[MutableMapping[Text, Text]] = ..., diff --git a/python/helpers/typeshed/third_party/2and3/requests/status_codes.pyi b/python/helpers/typeshed/stubs/requests/requests/status_codes.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/status_codes.pyi rename to python/helpers/typeshed/stubs/requests/requests/status_codes.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/structures.pyi b/python/helpers/typeshed/stubs/requests/requests/structures.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/structures.pyi rename to python/helpers/typeshed/stubs/requests/requests/structures.pyi diff --git a/python/helpers/typeshed/third_party/2and3/requests/utils.pyi b/python/helpers/typeshed/stubs/requests/requests/utils.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/requests/utils.pyi rename to python/helpers/typeshed/stubs/requests/requests/utils.pyi diff --git a/python/helpers/typeshed/stubs/retry/METADATA.toml b/python/helpers/typeshed/stubs/retry/METADATA.toml new file mode 100644 index 000000000000..31f638bf33df --- /dev/null +++ b/python/helpers/typeshed/stubs/retry/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +python2 = true diff --git a/python/helpers/typeshed/third_party/2and3/retry/__init__.pyi b/python/helpers/typeshed/stubs/retry/retry/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/retry/__init__.pyi rename to python/helpers/typeshed/stubs/retry/retry/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2and3/retry/api.pyi b/python/helpers/typeshed/stubs/retry/retry/api.pyi similarity index 97% rename from python/helpers/typeshed/third_party/2and3/retry/api.pyi rename to python/helpers/typeshed/stubs/retry/retry/api.pyi index 37fa2009d6a8..88f274b9d1c3 100644 --- a/python/helpers/typeshed/third_party/2and3/retry/api.pyi +++ b/python/helpers/typeshed/stubs/retry/retry/api.pyi @@ -25,4 +25,4 @@ def retry( backoff: float = ..., jitter: Union[Tuple[float, float], float] = ..., logger: Optional[Logger] = ..., -) -> _Decorator: ... +) -> _Decorator[_T]: ... diff --git a/python/helpers/typeshed/third_party/2/six/__init__.pyi b/python/helpers/typeshed/stubs/six/@python2/six/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/__init__.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/BaseHTTPServer.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/BaseHTTPServer.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/BaseHTTPServer.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/BaseHTTPServer.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/CGIHTTPServer.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/CGIHTTPServer.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/CGIHTTPServer.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/CGIHTTPServer.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/SimpleHTTPServer.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/SimpleHTTPServer.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/SimpleHTTPServer.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/SimpleHTTPServer.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/__init__.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/__init__.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/_dummy_thread.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/_dummy_thread.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/_dummy_thread.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/_dummy_thread.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/_thread.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/_thread.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/_thread.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/_thread.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/cPickle.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/cPickle.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/cPickle.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/cPickle.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/collections_abc.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/collections_abc.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/collections_abc.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/collections_abc.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/configparser.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/configparser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/configparser.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/configparser.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/email_mime_base.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/email_mime_base.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/email_mime_base.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/email_mime_base.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/email_mime_multipart.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/email_mime_multipart.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/email_mime_multipart.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/email_mime_multipart.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/email_mime_nonmultipart.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/email_mime_nonmultipart.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/email_mime_nonmultipart.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/email_mime_nonmultipart.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/email_mime_text.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/email_mime_text.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/email_mime_text.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/email_mime_text.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/html_entities.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/html_entities.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/html_entities.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/html_entities.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/html_parser.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/html_parser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/html_parser.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/html_parser.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/http_client.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/http_client.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/http_client.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/http_client.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/http_cookiejar.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/http_cookiejar.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/http_cookiejar.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/http_cookiejar.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/http_cookies.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/http_cookies.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/http_cookies.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/http_cookies.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/queue.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/queue.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/queue.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/queue.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/reprlib.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/reprlib.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/reprlib.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/reprlib.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/socketserver.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/socketserver.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/socketserver.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/socketserver.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/urllib/__init__.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/urllib/__init__.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/__init__.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/urllib/error.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/error.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/urllib/error.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/error.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/urllib/parse.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/parse.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/urllib/parse.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/parse.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/urllib/request.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/request.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/urllib/request.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/request.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/urllib/response.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/response.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/urllib/response.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/response.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/urllib/robotparser.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/robotparser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/urllib/robotparser.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/urllib/robotparser.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/urllib_error.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/urllib_error.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/urllib_error.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/urllib_error.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/urllib_parse.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/urllib_parse.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/urllib_parse.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/urllib_parse.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/urllib_request.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/urllib_request.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/urllib_request.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/urllib_request.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/urllib_response.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/urllib_response.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/urllib_response.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/urllib_response.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/urllib_robotparser.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/urllib_robotparser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/urllib_robotparser.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/urllib_robotparser.pyi diff --git a/python/helpers/typeshed/third_party/2/six/moves/xmlrpc_client.pyi b/python/helpers/typeshed/stubs/six/@python2/six/moves/xmlrpc_client.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2/six/moves/xmlrpc_client.pyi rename to python/helpers/typeshed/stubs/six/@python2/six/moves/xmlrpc_client.pyi diff --git a/python/helpers/typeshed/stubs/six/METADATA.toml b/python/helpers/typeshed/stubs/six/METADATA.toml new file mode 100644 index 000000000000..31f638bf33df --- /dev/null +++ b/python/helpers/typeshed/stubs/six/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +python2 = true diff --git a/python/helpers/typeshed/third_party/3/six/__init__.pyi b/python/helpers/typeshed/stubs/six/six/__init__.pyi similarity index 94% rename from python/helpers/typeshed/third_party/3/six/__init__.pyi rename to python/helpers/typeshed/stubs/six/six/__init__.pyi index bd055bbca80a..80b21672db27 100644 --- a/python/helpers/typeshed/third_party/3/six/__init__.pyi +++ b/python/helpers/typeshed/stubs/six/six/__init__.pyi @@ -61,14 +61,14 @@ def get_function_closure(fun: types.FunctionType) -> Optional[Tuple[types._Cell, def get_function_code(fun: types.FunctionType) -> types.CodeType: ... def get_function_defaults(fun: types.FunctionType) -> Optional[Tuple[Any, ...]]: ... def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ... -def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ... -def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ... +def iterkeys(d: Mapping[_K, Any]) -> typing.Iterator[_K]: ... +def itervalues(d: Mapping[Any, _V]) -> typing.Iterator[_V]: ... def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ... # def iterlists -def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ... -def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ... +def viewkeys(d: Mapping[_K, Any]) -> KeysView[_K]: ... +def viewvalues(d: Mapping[Any, _V]) -> ValuesView[_V]: ... def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ... def b(s: str) -> binary_type: ... def u(s: str) -> text_type: ... diff --git a/python/helpers/typeshed/third_party/3/six/moves/BaseHTTPServer.pyi b/python/helpers/typeshed/stubs/six/six/moves/BaseHTTPServer.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/BaseHTTPServer.pyi rename to python/helpers/typeshed/stubs/six/six/moves/BaseHTTPServer.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/CGIHTTPServer.pyi b/python/helpers/typeshed/stubs/six/six/moves/CGIHTTPServer.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/CGIHTTPServer.pyi rename to python/helpers/typeshed/stubs/six/six/moves/CGIHTTPServer.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/SimpleHTTPServer.pyi b/python/helpers/typeshed/stubs/six/six/moves/SimpleHTTPServer.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/SimpleHTTPServer.pyi rename to python/helpers/typeshed/stubs/six/six/moves/SimpleHTTPServer.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/__init__.pyi b/python/helpers/typeshed/stubs/six/six/moves/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/__init__.pyi rename to python/helpers/typeshed/stubs/six/six/moves/__init__.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/_dummy_thread.pyi b/python/helpers/typeshed/stubs/six/six/moves/_dummy_thread.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/_dummy_thread.pyi rename to python/helpers/typeshed/stubs/six/six/moves/_dummy_thread.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/_thread.pyi b/python/helpers/typeshed/stubs/six/six/moves/_thread.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/_thread.pyi rename to python/helpers/typeshed/stubs/six/six/moves/_thread.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/builtins.pyi b/python/helpers/typeshed/stubs/six/six/moves/builtins.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/builtins.pyi rename to python/helpers/typeshed/stubs/six/six/moves/builtins.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/cPickle.pyi b/python/helpers/typeshed/stubs/six/six/moves/cPickle.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/cPickle.pyi rename to python/helpers/typeshed/stubs/six/six/moves/cPickle.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/collections_abc.pyi b/python/helpers/typeshed/stubs/six/six/moves/collections_abc.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/collections_abc.pyi rename to python/helpers/typeshed/stubs/six/six/moves/collections_abc.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/configparser.pyi b/python/helpers/typeshed/stubs/six/six/moves/configparser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/configparser.pyi rename to python/helpers/typeshed/stubs/six/six/moves/configparser.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/email_mime_base.pyi b/python/helpers/typeshed/stubs/six/six/moves/email_mime_base.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/email_mime_base.pyi rename to python/helpers/typeshed/stubs/six/six/moves/email_mime_base.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/email_mime_multipart.pyi b/python/helpers/typeshed/stubs/six/six/moves/email_mime_multipart.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/email_mime_multipart.pyi rename to python/helpers/typeshed/stubs/six/six/moves/email_mime_multipart.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/email_mime_nonmultipart.pyi b/python/helpers/typeshed/stubs/six/six/moves/email_mime_nonmultipart.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/email_mime_nonmultipart.pyi rename to python/helpers/typeshed/stubs/six/six/moves/email_mime_nonmultipart.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/email_mime_text.pyi b/python/helpers/typeshed/stubs/six/six/moves/email_mime_text.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/email_mime_text.pyi rename to python/helpers/typeshed/stubs/six/six/moves/email_mime_text.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/html_entities.pyi b/python/helpers/typeshed/stubs/six/six/moves/html_entities.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/html_entities.pyi rename to python/helpers/typeshed/stubs/six/six/moves/html_entities.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/html_parser.pyi b/python/helpers/typeshed/stubs/six/six/moves/html_parser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/html_parser.pyi rename to python/helpers/typeshed/stubs/six/six/moves/html_parser.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/http_client.pyi b/python/helpers/typeshed/stubs/six/six/moves/http_client.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/http_client.pyi rename to python/helpers/typeshed/stubs/six/six/moves/http_client.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/http_cookiejar.pyi b/python/helpers/typeshed/stubs/six/six/moves/http_cookiejar.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/http_cookiejar.pyi rename to python/helpers/typeshed/stubs/six/six/moves/http_cookiejar.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/http_cookies.pyi b/python/helpers/typeshed/stubs/six/six/moves/http_cookies.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/http_cookies.pyi rename to python/helpers/typeshed/stubs/six/six/moves/http_cookies.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/queue.pyi b/python/helpers/typeshed/stubs/six/six/moves/queue.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/queue.pyi rename to python/helpers/typeshed/stubs/six/six/moves/queue.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/reprlib.pyi b/python/helpers/typeshed/stubs/six/six/moves/reprlib.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/reprlib.pyi rename to python/helpers/typeshed/stubs/six/six/moves/reprlib.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/socketserver.pyi b/python/helpers/typeshed/stubs/six/six/moves/socketserver.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/socketserver.pyi rename to python/helpers/typeshed/stubs/six/six/moves/socketserver.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/tkinter.pyi b/python/helpers/typeshed/stubs/six/six/moves/tkinter.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/tkinter.pyi rename to python/helpers/typeshed/stubs/six/six/moves/tkinter.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/tkinter_commondialog.pyi b/python/helpers/typeshed/stubs/six/six/moves/tkinter_commondialog.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/tkinter_commondialog.pyi rename to python/helpers/typeshed/stubs/six/six/moves/tkinter_commondialog.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/tkinter_constants.pyi b/python/helpers/typeshed/stubs/six/six/moves/tkinter_constants.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/tkinter_constants.pyi rename to python/helpers/typeshed/stubs/six/six/moves/tkinter_constants.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/tkinter_dialog.pyi b/python/helpers/typeshed/stubs/six/six/moves/tkinter_dialog.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/tkinter_dialog.pyi rename to python/helpers/typeshed/stubs/six/six/moves/tkinter_dialog.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/tkinter_filedialog.pyi b/python/helpers/typeshed/stubs/six/six/moves/tkinter_filedialog.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/tkinter_filedialog.pyi rename to python/helpers/typeshed/stubs/six/six/moves/tkinter_filedialog.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/tkinter_tkfiledialog.pyi b/python/helpers/typeshed/stubs/six/six/moves/tkinter_tkfiledialog.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/tkinter_tkfiledialog.pyi rename to python/helpers/typeshed/stubs/six/six/moves/tkinter_tkfiledialog.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/tkinter_ttk.pyi b/python/helpers/typeshed/stubs/six/six/moves/tkinter_ttk.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/tkinter_ttk.pyi rename to python/helpers/typeshed/stubs/six/six/moves/tkinter_ttk.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/urllib/__init__.pyi b/python/helpers/typeshed/stubs/six/six/moves/urllib/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/urllib/__init__.pyi rename to python/helpers/typeshed/stubs/six/six/moves/urllib/__init__.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/urllib/error.pyi b/python/helpers/typeshed/stubs/six/six/moves/urllib/error.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/urllib/error.pyi rename to python/helpers/typeshed/stubs/six/six/moves/urllib/error.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/urllib/parse.pyi b/python/helpers/typeshed/stubs/six/six/moves/urllib/parse.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/urllib/parse.pyi rename to python/helpers/typeshed/stubs/six/six/moves/urllib/parse.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/urllib/request.pyi b/python/helpers/typeshed/stubs/six/six/moves/urllib/request.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/urllib/request.pyi rename to python/helpers/typeshed/stubs/six/six/moves/urllib/request.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/urllib/response.pyi b/python/helpers/typeshed/stubs/six/six/moves/urllib/response.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/urllib/response.pyi rename to python/helpers/typeshed/stubs/six/six/moves/urllib/response.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/urllib/robotparser.pyi b/python/helpers/typeshed/stubs/six/six/moves/urllib/robotparser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/urllib/robotparser.pyi rename to python/helpers/typeshed/stubs/six/six/moves/urllib/robotparser.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/urllib_error.pyi b/python/helpers/typeshed/stubs/six/six/moves/urllib_error.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/urllib_error.pyi rename to python/helpers/typeshed/stubs/six/six/moves/urllib_error.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/urllib_parse.pyi b/python/helpers/typeshed/stubs/six/six/moves/urllib_parse.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/urllib_parse.pyi rename to python/helpers/typeshed/stubs/six/six/moves/urllib_parse.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/urllib_request.pyi b/python/helpers/typeshed/stubs/six/six/moves/urllib_request.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/urllib_request.pyi rename to python/helpers/typeshed/stubs/six/six/moves/urllib_request.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/urllib_response.pyi b/python/helpers/typeshed/stubs/six/six/moves/urllib_response.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/urllib_response.pyi rename to python/helpers/typeshed/stubs/six/six/moves/urllib_response.pyi diff --git a/python/helpers/typeshed/third_party/3/six/moves/urllib_robotparser.pyi b/python/helpers/typeshed/stubs/six/six/moves/urllib_robotparser.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/six/moves/urllib_robotparser.pyi rename to python/helpers/typeshed/stubs/six/six/moves/urllib_robotparser.pyi diff --git a/python/helpers/typeshed/stubs/typed-ast/METADATA.toml b/python/helpers/typeshed/stubs/typed-ast/METADATA.toml new file mode 100644 index 000000000000..46f5153ea243 --- /dev/null +++ b/python/helpers/typeshed/stubs/typed-ast/METADATA.toml @@ -0,0 +1 @@ +version = "1.4" diff --git a/python/helpers/typeshed/third_party/3/typed_ast/__init__.pyi b/python/helpers/typeshed/stubs/typed-ast/typed_ast/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/typed_ast/__init__.pyi rename to python/helpers/typeshed/stubs/typed-ast/typed_ast/__init__.pyi diff --git a/python/helpers/typeshed/third_party/3/typed_ast/ast27.pyi b/python/helpers/typeshed/stubs/typed-ast/typed_ast/ast27.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/typed_ast/ast27.pyi rename to python/helpers/typeshed/stubs/typed-ast/typed_ast/ast27.pyi diff --git a/python/helpers/typeshed/third_party/3/typed_ast/ast3.pyi b/python/helpers/typeshed/stubs/typed-ast/typed_ast/ast3.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/typed_ast/ast3.pyi rename to python/helpers/typeshed/stubs/typed-ast/typed_ast/ast3.pyi diff --git a/python/helpers/typeshed/third_party/3/typed_ast/conversions.pyi b/python/helpers/typeshed/stubs/typed-ast/typed_ast/conversions.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/typed_ast/conversions.pyi rename to python/helpers/typeshed/stubs/typed-ast/typed_ast/conversions.pyi diff --git a/python/helpers/typeshed/stubs/typing-extensions/METADATA.toml b/python/helpers/typeshed/stubs/typing-extensions/METADATA.toml new file mode 100644 index 000000000000..9509ba1a7b30 --- /dev/null +++ b/python/helpers/typeshed/stubs/typing-extensions/METADATA.toml @@ -0,0 +1,2 @@ +version = "3.7" +python2 = true diff --git a/python/helpers/typeshed/third_party/2and3/typing_extensions.pyi b/python/helpers/typeshed/stubs/typing-extensions/typing_extensions.pyi similarity index 99% rename from python/helpers/typeshed/third_party/2and3/typing_extensions.pyi rename to python/helpers/typeshed/stubs/typing-extensions/typing_extensions.pyi index f103a0faf36d..3ca636af8b80 100644 --- a/python/helpers/typeshed/third_party/2and3/typing_extensions.pyi +++ b/python/helpers/typeshed/stubs/typing-extensions/typing_extensions.pyi @@ -51,7 +51,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): # can go through. def setdefault(self, k: NoReturn, default: object) -> object: ... # Mypy plugin hook for 'pop' expects that 'default' has a type variable type. - def pop(self, k: NoReturn, default: _T = ...) -> object: ... + def pop(self, k: NoReturn, default: _T = ...) -> object: ... # type: ignore def update(self: _T, __m: _T) -> None: ... if sys.version_info < (3, 0): def has_key(self, k: str) -> bool: ... diff --git a/python/helpers/typeshed/stubs/tzlocal/METADATA.toml b/python/helpers/typeshed/stubs/tzlocal/METADATA.toml new file mode 100644 index 000000000000..43a3246aeece --- /dev/null +++ b/python/helpers/typeshed/stubs/tzlocal/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.1" +python2 = true +requires = ["types-pytz"] diff --git a/python/helpers/typeshed/third_party/2and3/tzlocal/__init__.pyi b/python/helpers/typeshed/stubs/tzlocal/tzlocal/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/2and3/tzlocal/__init__.pyi rename to python/helpers/typeshed/stubs/tzlocal/tzlocal/__init__.pyi diff --git a/python/helpers/typeshed/stubs/waitress/METADATA.toml b/python/helpers/typeshed/stubs/waitress/METADATA.toml new file mode 100644 index 000000000000..1071ae7e9d86 --- /dev/null +++ b/python/helpers/typeshed/stubs/waitress/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +requires = ["types-typing-extensions"] diff --git a/python/helpers/typeshed/third_party/3/waitress/__init__.pyi b/python/helpers/typeshed/stubs/waitress/waitress/__init__.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/__init__.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/__init__.pyi diff --git a/python/helpers/typeshed/third_party/3/waitress/adjustments.pyi b/python/helpers/typeshed/stubs/waitress/waitress/adjustments.pyi similarity index 97% rename from python/helpers/typeshed/third_party/3/waitress/adjustments.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/adjustments.pyi index 54b15ee26da7..0343887a4b31 100644 --- a/python/helpers/typeshed/third_party/3/waitress/adjustments.pyi +++ b/python/helpers/typeshed/stubs/waitress/waitress/adjustments.pyi @@ -4,8 +4,8 @@ from typing import Any, Dict, FrozenSet, Iterable, List, Optional, Sequence, Set from .compat import HAS_IPV6 as HAS_IPV6, PY2 as PY2, WIN as WIN, string_types as string_types from .proxy_headers import PROXY_HEADERS as PROXY_HEADERS -truthy: FrozenSet -KNOWN_PROXY_HEADERS: FrozenSet +truthy: FrozenSet[Any] +KNOWN_PROXY_HEADERS: FrozenSet[Any] def asbool(s: Optional[Union[bool, str, int]]) -> bool: ... def asoctal(s: str) -> int: ... diff --git a/python/helpers/typeshed/third_party/3/waitress/buffers.pyi b/python/helpers/typeshed/stubs/waitress/waitress/buffers.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/buffers.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/buffers.pyi diff --git a/python/helpers/typeshed/third_party/3/waitress/channel.pyi b/python/helpers/typeshed/stubs/waitress/waitress/channel.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/channel.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/channel.pyi diff --git a/python/helpers/typeshed/third_party/3/waitress/compat.pyi b/python/helpers/typeshed/stubs/waitress/waitress/compat.pyi similarity index 98% rename from python/helpers/typeshed/third_party/3/waitress/compat.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/compat.pyi index 3e8fd859c803..42c62f43e32b 100644 --- a/python/helpers/typeshed/third_party/3/waitress/compat.pyi +++ b/python/helpers/typeshed/stubs/waitress/waitress/compat.pyi @@ -1,4 +1,3 @@ -import sys from io import TextIOWrapper from typing import Any, Optional, Tuple diff --git a/python/helpers/typeshed/third_party/3/waitress/parser.pyi b/python/helpers/typeshed/stubs/waitress/waitress/parser.pyi similarity index 92% rename from python/helpers/typeshed/third_party/3/waitress/parser.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/parser.pyi index 551bad0a300a..48a3d210f74e 100644 --- a/python/helpers/typeshed/third_party/3/waitress/parser.pyi +++ b/python/helpers/typeshed/stubs/waitress/waitress/parser.pyi @@ -1,5 +1,5 @@ from io import BytesIO -from typing import Mapping, Optional, Pattern, Sequence, Tuple, Union +from typing import Any, Mapping, Optional, Pattern, Sequence, Tuple, Union from waitress.adjustments import Adjustments from waitress.receiver import ChunkedReceiver, FixedStreamReceiver @@ -38,6 +38,6 @@ class HTTPRequestParser: def split_uri(uri: bytes) -> Tuple[str, str, bytes, str, str]: ... def get_header_lines(header: bytes) -> Sequence[bytes]: ... -first_line_re: Pattern +first_line_re: Pattern[Any] def crack_first_line(line: str) -> Tuple[bytes, bytes, bytes]: ... diff --git a/python/helpers/typeshed/third_party/3/waitress/proxy_headers.pyi b/python/helpers/typeshed/stubs/waitress/waitress/proxy_headers.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/proxy_headers.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/proxy_headers.pyi diff --git a/python/helpers/typeshed/third_party/3/waitress/receiver.pyi b/python/helpers/typeshed/stubs/waitress/waitress/receiver.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/receiver.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/receiver.pyi diff --git a/python/helpers/typeshed/third_party/3/waitress/rfc7230.pyi b/python/helpers/typeshed/stubs/waitress/waitress/rfc7230.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/rfc7230.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/rfc7230.pyi diff --git a/python/helpers/typeshed/third_party/3/waitress/runner.pyi b/python/helpers/typeshed/stubs/waitress/waitress/runner.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/runner.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/runner.pyi diff --git a/python/helpers/typeshed/third_party/3/waitress/server.pyi b/python/helpers/typeshed/stubs/waitress/waitress/server.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/server.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/server.pyi diff --git a/python/helpers/typeshed/third_party/3/waitress/task.pyi b/python/helpers/typeshed/stubs/waitress/waitress/task.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/task.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/task.pyi diff --git a/python/helpers/typeshed/third_party/3/waitress/trigger.pyi b/python/helpers/typeshed/stubs/waitress/waitress/trigger.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/trigger.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/trigger.pyi diff --git a/python/helpers/typeshed/third_party/3/waitress/utilities.pyi b/python/helpers/typeshed/stubs/waitress/waitress/utilities.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/utilities.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/utilities.pyi diff --git a/python/helpers/typeshed/third_party/3/waitress/wasyncore.pyi b/python/helpers/typeshed/stubs/waitress/waitress/wasyncore.pyi similarity index 100% rename from python/helpers/typeshed/third_party/3/waitress/wasyncore.pyi rename to python/helpers/typeshed/stubs/waitress/waitress/wasyncore.pyi diff --git a/python/helpers/typeshed/stubs/xxhash/METADATA.toml b/python/helpers/typeshed/stubs/xxhash/METADATA.toml new file mode 100644 index 000000000000..31f638bf33df --- /dev/null +++ b/python/helpers/typeshed/stubs/xxhash/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.1" +python2 = true diff --git a/python/helpers/typeshed/third_party/2and3/xxhash.pyi b/python/helpers/typeshed/stubs/xxhash/xxhash.pyi similarity index 95% rename from python/helpers/typeshed/third_party/2and3/xxhash.pyi rename to python/helpers/typeshed/stubs/xxhash/xxhash.pyi index dc31adb6e45a..97b1a2d0e966 100644 --- a/python/helpers/typeshed/third_party/2and3/xxhash.pyi +++ b/python/helpers/typeshed/stubs/xxhash/xxhash.pyi @@ -10,7 +10,7 @@ VERSION: str XXHASH_VERSION: str class _IntDigestHash(_Hash): - def __init__(self, __string: ReadableBuffer = ...): ... + def __init__(self, __string: ReadableBuffer = ...) -> None: ... def intdigest(self) -> int: ... # python-xxhash v2.0.0 does not support the string or usedforsecurity kwargs diff --git a/python/helpers/typeshed/tests/check_consistent.py b/python/helpers/typeshed/tests/check_consistent.py index 8abb09610a65..15949e045aac 100644 --- a/python/helpers/typeshed/tests/check_consistent.py +++ b/python/helpers/typeshed/tests/check_consistent.py @@ -1,8 +1,12 @@ #!/usr/bin/env python3 -# For various reasons we need the contents of certain files to be -# duplicated in two places, for example stdlib/2/builtins.pyi and -# stdlib/2/__builtin__.pyi must be identical. In the past we used +# For security (and simplicity) reasons, only a limited kind of files can be +# present in /stdlib and /stubs directories, see README for detail. Here we +# verify these constraints. + +# In addition, for various reasons we need the contents of certain files to be +# duplicated in two places, for example stdlib/@python2/builtins.pyi and +# stdlib/@python2/__builtin__.pyi must be identical. In the past we used # symlinks but that doesn't always work on Windows, so now you must # manually update both files, and this test verifies that they are # identical. The list below indicates which sets of files must match. @@ -10,13 +14,72 @@ import filecmp import os +import toml + consistent_files = [ - {"stdlib/2/builtins.pyi", "stdlib/2/__builtin__.pyi"}, - {"stdlib/2and3/threading.pyi", "stdlib/2and3/_dummy_threading.pyi"}, + {"stdlib/@python2/builtins.pyi", "stdlib/@python2/__builtin__.pyi"}, + {"stdlib/threading.pyi", "stdlib/_dummy_threading.pyi"}, ] -def main(): +def assert_stubs_only(directory): + """Check that given directory contains only valid stub files.""" + top = directory.split(os.sep)[-1] + assert top.isidentifier(), f"Bad directory name: {top}" + for _, dirs, files in os.walk(directory): + for file in files: + name, ext = os.path.splitext(file) + assert name.isidentifier(), f"Files must be valid modules, got: {name}" + assert ext == ".pyi", f"Only stub flies allowed. Got: {file} in {directory}" + for subdir in dirs: + assert subdir.isidentifier(), f"Directories must be valid packages, got: {subdir}" + + +def check_stdlib(): + for entry in os.listdir("stdlib"): + if os.path.isfile(os.path.join("stdlib", entry)): + name, ext = os.path.splitext(entry) + if ext != ".pyi": + assert entry == "VERSIONS", f"Unexpected file in stdlib root: {entry}" + assert name.isidentifier(), "Bad file name in stdlib" + else: + if entry == "@python2": + continue + assert_stubs_only(os.path.join("stdlib", entry)) + for entry in os.listdir("stdlib/@python2"): + if os.path.isfile(os.path.join("stdlib/@python2", entry)): + name, ext = os.path.splitext(entry) + assert name.isidentifier(), "Bad file name in stdlib" + assert ext == ".pyi", "Unexpected file in stdlib/@python2 root" + else: + assert_stubs_only(os.path.join("stdlib/@python2", entry)) + + +def check_stubs(): + for distribution in os.listdir("stubs"): + assert not os.path.isfile(distribution), f"Only directories allowed in stubs, got {distribution}" + for entry in os.listdir(os.path.join("stubs", distribution)): + if os.path.isfile(os.path.join("stubs", distribution, entry)): + name, ext = os.path.splitext(entry) + if ext != ".pyi": + assert entry in {"METADATA.toml", "README", "README.md", "README.rst"}, entry + else: + assert name.isidentifier(), f"Bad file name '{entry}' in stubs" + else: + if entry == "@python2": + continue + assert_stubs_only(os.path.join("stubs", distribution, entry)) + if os.path.isdir(os.path.join("stubs", distribution, "@python2")): + for entry in os.listdir(os.path.join("stubs", distribution, "@python2")): + if os.path.isfile(os.path.join("stubs", distribution, "@python2", entry)): + name, ext = os.path.splitext(entry) + assert name.isidentifier(), f"Bad file name '{entry}' in stubs" + assert ext == ".pyi", f"Unexpected file {entry} in @python2 stubs" + else: + assert_stubs_only(os.path.join("stubs", distribution, "@python2", entry)) + + +def check_same_files(): files = [os.path.join(root, file) for root, dir, files in os.walk(".") for file in files] no_symlink = "You cannot use symlinks in typeshed, please copy {} to its link." for file in files: @@ -34,5 +97,95 @@ def main(): ) +def check_versions(): + versions = {} + with open("stdlib/VERSIONS") as f: + data = f.read().splitlines() + for line in data: + if not line or line.lstrip().startswith("#"): + continue + assert ": " in line, f"Bad line in VERSIONS: {line}" + module, version = line.split(": ") + msg = f"Unsupported Python version{version}" + assert version.count(".") == 1, msg + major, minor = version.split(".") + assert major in {"2", "3"}, msg + assert minor.isdigit(), msg + assert module not in versions, f"Duplicate module {module} in VERSIONS" + versions[module] = (int(major), int(minor)) + modules = set() + for entry in os.listdir("stdlib"): + if entry == "@python2" or entry == "VERSIONS": + continue + if os.path.isfile(os.path.join("stdlib", entry)): + mod, _ = os.path.splitext(entry) + modules.add(mod) + else: + modules.add(entry) + extra = modules - set(versions) + assert not extra, f"Modules not in versions: {extra}" + extra = set(versions) - modules + assert not extra, f"Versions not in modules: {extra}" + + +def _strip_dep_version(dependency): + dep_version_pos = len(dependency) + for pos, c in enumerate(dependency): + if c in "=<>": + dep_version_pos = pos + break + stripped = dependency[:dep_version_pos] + rest = dependency[dep_version_pos:] + if not rest: + return stripped, "", "" + number_pos = 0 + for pos, c in enumerate(rest): + if c not in "=<>": + number_pos = pos + break + relation = rest[:number_pos] + version = rest[number_pos:] + return stripped, relation, version + + +def check_metadata(): + known_distributions = set(os.listdir("stubs")) + for distribution in os.listdir("stubs"): + with open(os.path.join("stubs", distribution, "METADATA.toml")) as f: + data = toml.loads(f.read()) + assert "version" in data, f"Missing version for {distribution}" + version = data["version"] + msg = f"Unsupported Python version {version}" + assert version.count(".") == 1, msg + major, minor = version.split(".") + assert major.isdigit() and minor.isdigit(), msg + for key in data: + assert key in { + "version", "python2", "python3", "requires" + }, f"Unexpected key {key} for {distribution}" + assert isinstance(data.get("python2", False), bool), f"Invalid python2 value for {distribution}" + assert isinstance(data.get("python3", True), bool), f"Invalid python3 value for {distribution}" + assert isinstance(data.get("requires", []), list), f"Invalid requires value for {distribution}" + for dep in data.get("requires", []): + assert isinstance(dep, str), f"Invalid dependency {dep} for {distribution}" + assert dep.startswith("types-"), f"Only stub dependencies supported, got {dep}" + dep = dep[len("types-"):] + for space in " \t\n": + assert space not in dep, f"For consistency dependency should not have whitespace: {dep}" + assert ";" not in dep, f"Semicolons in dependencies are not supported, got {dep}" + stripped, relation, dep_version = _strip_dep_version(dep) + assert stripped in known_distributions, f"Only dependencies from typeshed are supported, got {stripped}" + if relation: + msg = f"Bad version in dependency {dep}" + assert relation in {"==", ">", ">=", "<", "<="}, msg + assert version.count(".") <= 2, msg + for part in version.split("."): + assert part.isnumeric(), msg + + if __name__ == "__main__": - main() + check_stdlib() + check_versions() + check_stubs() + check_metadata() + check_same_files() diff --git a/python/helpers/typeshed/tests/mypy_self_check.py b/python/helpers/typeshed/tests/mypy_self_check.py index 8d8c77924a74..9632794912a6 100644 --- a/python/helpers/typeshed/tests/mypy_self_check.py +++ b/python/helpers/typeshed/tests/mypy_self_check.py @@ -1,12 +1,15 @@ #!/usr/bin/env python3 """Script to run mypy against its own code base.""" +import os import subprocess import sys import tempfile from pathlib import Path -MYPY_VERSION = "0.790" +# Use the current mypy version until a version that supports modular +# typeshed is released on PyPI. +MYPY_VERSION = "git+git://github.com/python/mypy" if __name__ == "__main__": @@ -16,8 +19,9 @@ if __name__ == "__main__": ["git", "clone", "--depth", "1", "git://github.com/python/mypy", dirpath], check=True, ) + os.environ["MYPYPATH"] = str(dirpath) try: - subprocess.run([sys.executable, "-m", "pip", "install", f"mypy=={MYPY_VERSION}"], check=True) + subprocess.run([sys.executable, "-m", "pip", "install", "-U", MYPY_VERSION], check=True) subprocess.run([sys.executable, "-m", "pip", "install", "-r", dirpath / "test-requirements.txt"], check=True) subprocess.run( [ @@ -26,8 +30,8 @@ if __name__ == "__main__": dirpath / "mypy_self_check.ini", "--custom-typeshed-dir", ".", - dirpath / "mypy", - dirpath / "mypyc", + "-p", "mypy", + "-p", "mypyc", ], check=True, ) diff --git a/python/helpers/typeshed/tests/mypy_test.py b/python/helpers/typeshed/tests/mypy_test.py index 29e9a31cc62c..f6eea3adbd17 100644 --- a/python/helpers/typeshed/tests/mypy_test.py +++ b/python/helpers/typeshed/tests/mypy_test.py @@ -16,8 +16,14 @@ import argparse import os import re import sys +import toml -parser = argparse.ArgumentParser(description="Test runner for typeshed. " "Patterns are unanchored regexps on the full path.") +PY2_NAMESPACE = "@python2" +THIRD_PARTY_NAMESPACE = "stubs" + +parser = argparse.ArgumentParser( + description="Test runner for typeshed. Patterns are unanchored regexps on the full path." +) parser.add_argument("-v", "--verbose", action="count", default=0, help="More output") parser.add_argument("-n", "--dry-run", action="store_true", help="Don't actually run mypy") parser.add_argument("-x", "--exclude", type=str, nargs="*", help="Exclude pattern") @@ -63,17 +69,53 @@ def match(fn, args, exclude_list): return True -def libpath(major, minor): - versions = ["%d.%d" % (major, minor) for minor in reversed(range(minor + 1))] - versions.append(str(major)) - versions.append("2and3") - paths = [] - for v in versions: - for top in ["stdlib", "third_party"]: - p = os.path.join(top, v) - if os.path.isdir(p): - paths.append(p) - return paths +def parse_versions(fname): + with open(fname) as f: + data = f.read().splitlines() + result = {} + for line in data: + # Allow having some comments or empty lines. + if not line.strip() or line.startswith("#"): + continue + mod, ver_str = line.split(": ") + assert ver_str.count(".") == 1 + major, minor = ver_str.split(".") + result[mod] = (int(major), int(minor)) + return result + + +def is_supported(distribution, major): + with open(os.path.join(THIRD_PARTY_NAMESPACE, distribution, "METADATA.toml")) as f: + data = dict(toml.loads(f.read())) + if major == 2: + # Python 2 is not supported by default. + return bool(data.get("python2", False)) + # Python 3 is supported by default. + return bool(data.get("python3", True)) + + +def add_files(files, seen, root, name, args, exclude_list): + """Add all files in package or module represented by 'name' located in 'root'.""" + full = os.path.join(root, name) + mod, ext = os.path.splitext(name) + if ext in [".pyi", ".py"]: + if match(full, args, exclude_list): + seen.add(mod) + files.append(full) + elif ( + os.path.isfile(os.path.join(full, "__init__.pyi")) or + os.path.isfile(os.path.join(full, "__init__.py")) + ): + for r, ds, fs in os.walk(full): + ds.sort() + fs.sort() + for f in fs: + m, x = os.path.splitext(f) + if x in [".pyi", ".py"]: + fn = os.path.join(r, f) + if match(fn, args, exclude_list): + seen.add(mod) + files.append(fn) def main(): @@ -88,7 +130,7 @@ def main(): print("Cannot import mypy. Did you install it?") sys.exit(1) - versions = [(3, 9), (3, 8), (3, 7), (3, 6), (3, 5), (2, 7)] + versions = [(3, 9), (3, 8), (3, 7), (3, 6), (2, 7)] if args.python_version: versions = [v for v in versions if any(("%d.%d" % v).startswith(av) for av in args.python_version)] if not versions: @@ -98,44 +140,58 @@ def main(): code = 0 runs = 0 for major, minor in versions: - roots = libpath(major, minor) files = [] seen = {"__builtin__", "builtins", "typing"} # Always ignore these. - for root in roots: - names = os.listdir(root) - for name in names: - full = os.path.join(root, name) - mod, ext = os.path.splitext(name) + + # First add standard library files. + if major == 2: + root = os.path.join("stdlib", PY2_NAMESPACE) + for name in os.listdir(root): + mod, _ = os.path.splitext(name) if mod in seen or mod.startswith("."): continue - if ext in [".pyi", ".py"]: - if match(full, args, exclude_list): - seen.add(mod) - files.append(full) - elif os.path.isfile(os.path.join(full, "__init__.pyi")) or os.path.isfile(os.path.join(full, "__init__.py")): - for r, ds, fs in os.walk(full): - ds.sort() - fs.sort() - for f in fs: - m, x = os.path.splitext(f) - if x in [".pyi", ".py"]: - fn = os.path.join(r, f) - if match(fn, args, exclude_list): - seen.add(mod) - files.append(fn) + add_files(files, seen, root, name, args, exclude_list) + else: + supported_versions = parse_versions(os.path.join("stdlib", "VERSIONS")) + root = "stdlib" + for name in os.listdir(root): + if name == PY2_NAMESPACE or name == "VERSIONS": + continue + mod, _ = os.path.splitext(name) + if supported_versions[mod] > (major, minor): + continue + add_files(files, seen, root, name, args, exclude_list) + + # Next add files for all third party distributions. + for distribution in os.listdir(THIRD_PARTY_NAMESPACE): + if not is_supported(distribution, major): + continue + if major == 2 and os.path.isdir(os.path.join(THIRD_PARTY_NAMESPACE, distribution, PY2_NAMESPACE)): + root = os.path.join(THIRD_PARTY_NAMESPACE, distribution, PY2_NAMESPACE) + else: + root = os.path.join(THIRD_PARTY_NAMESPACE, distribution) + for name in os.listdir(root): + if name == PY2_NAMESPACE: + continue + mod, _ = os.path.splitext(name) + if mod in seen or mod.startswith("."): + continue + add_files(files, seen, root, name, args, exclude_list) + if files: runs += 1 - flags = ["--python-version", "%d.%d" % (major, minor)] - flags.append("--strict-optional") - flags.append("--no-site-packages") - flags.append("--show-traceback") - flags.append("--no-implicit-optional") - flags.append("--disallow-any-generics") - flags.append("--disallow-subclassing-any") - # Setting custom typeshed dir prevents mypy from falling back to its bundled typeshed in - # case of stub deletions - flags.append("--custom-typeshed-dir") - flags.append(os.path.dirname(os.path.dirname(__file__))) + flags = [ + "--python-version", "%d.%d" % (major, minor), + "--strict-optional", + "--no-site-packages", + "--show-traceback", + "--no-implicit-optional", + "--disallow-any-generics", + "--disallow-subclassing-any", + # Setting custom typeshed dir prevents mypy from falling back to its bundled + # typeshed in case of stub deletions + "--custom-typeshed-dir", os.path.dirname(os.path.dirname(__file__)), + ] if args.warn_unused_ignores: flags.append("--warn-unused-ignores") if args.platform: diff --git a/python/helpers/typeshed/tests/mypy_test_suite.py b/python/helpers/typeshed/tests/mypy_test_suite.py index 22fc8f8551e6..6ae1c176159f 100644 --- a/python/helpers/typeshed/tests/mypy_test_suite.py +++ b/python/helpers/typeshed/tests/mypy_test_suite.py @@ -16,8 +16,8 @@ if __name__ == "__main__": subprocess.run( [sys.executable, "-m", "pip", "install", "-U", "-r", dirpath / "mypy/test-requirements.txt"], check=True ) + shutil.rmtree(dirpath / "mypy/mypy/typeshed/stdlib") shutil.copytree("stdlib", dirpath / "mypy/mypy/typeshed/stdlib") - shutil.copytree("third_party", dirpath / "mypy/mypy/typeshed/third_party") try: subprocess.run([sys.executable, "runtests.py", "typeshed-ci"], cwd=dirpath / "mypy", check=True) except subprocess.CalledProcessError as e: diff --git a/python/helpers/typeshed/tests/pyright_exclude_list.txt b/python/helpers/typeshed/tests/pyright_exclude_list.txt new file mode 100644 index 000000000000..ad8bceb69c57 --- /dev/null +++ b/python/helpers/typeshed/tests/pyright_exclude_list.txt @@ -0,0 +1,3 @@ +Pyright is configured using a "pyrightconfig.json" file. You will find +it at the root of the repo. It contains an "exclude" section that accepts +globs for specifying which files and/or directories to exclude from analysis. diff --git a/python/helpers/typeshed/tests/pyright_test.py b/python/helpers/typeshed/tests/pyright_test.py new file mode 100644 index 000000000000..2d4f0a8e6ff3 --- /dev/null +++ b/python/helpers/typeshed/tests/pyright_test.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 + +import shutil +import subprocess +import sys +from pathlib import Path + +_PYRIGHT_VERSION = "1.1.115" +_WELL_KNOWN_FILE = Path("tests", "pyright_test.py") + + +def main() -> None: + if not _WELL_KNOWN_FILE.exists(): + print("pyright_test.py must be run from the typeshed root directory", file=sys.stderr) + sys.exit(1) + + # subprocess.run on Windows does not look in PATH. + npx = shutil.which("npx") + + if npx is None: + print("error finding npx; is Node.js installed?", file=sys.stderr) + sys.exit(1) + + try: + subprocess.run([npx, "--version"]) + except OSError: + print("error running npx; is Node.js installed?", file=sys.stderr) + sys.exit(1) + + command = [npx, "-p", "pyright@" + _PYRIGHT_VERSION, "pyright"] + sys.argv[1:] + + ret = subprocess.run(command).returncode + sys.exit(ret) + + +if __name__ == "__main__": + main() diff --git a/python/helpers/typeshed/tests/pytype_exclude_list.txt b/python/helpers/typeshed/tests/pytype_exclude_list.txt index 76064deeae90..f45719447aab 100644 --- a/python/helpers/typeshed/tests/pytype_exclude_list.txt +++ b/python/helpers/typeshed/tests/pytype_exclude_list.txt @@ -2,47 +2,46 @@ # pytype has its own version of these files, and thus doesn't mind if it # can't parse the typeshed version: -stdlib/2/__builtin__.pyi -stdlib/2/builtins.pyi -stdlib/2/typing.pyi -stdlib/3/builtins.pyi -stdlib/3/typing.pyi +stdlib/@python2/__builtin__.pyi +stdlib/@python2/builtins.pyi +stdlib/@python2/typing.pyi +stdlib/builtins.pyi +stdlib/typing.pyi # third_party stubs with constructs that pytype doesn't yet support: -third_party/2/fb303/FacebookService.pyi -third_party/2/scribe/scribe.pyi -third_party/2and3/attr/__init__.pyi -third_party/2and3/attr/converters.pyi -third_party/2and3/attr/filters.pyi -third_party/2and3/attr/validators.pyi -third_party/2and3/paramiko/_winapi.pyi -third_party/2and3/paramiko/win_pageant.pyi -third_party/2and3/pynamodb/models.pyi +stubs/fb303/fb303/FacebookService.pyi +stubs/scribe/scribe/scribe.pyi +stubs/attrs/attr/__init__.pyi +stubs/attrs/attr/converters.pyi +stubs/attrs/attr/filters.pyi +stubs/attrs/attr/validators.pyi +stubs/paramiko/paramiko/_winapi.pyi +stubs/paramiko/paramiko/win_pageant.pyi # _pb2.pyi have some constructs that break pytype # Eg # pytype.pyi.parser.ParseError: File: "/Users/nipunn/src/typeshed/third_party/2and3/google/protobuf/descriptor_pb2.pyi", line 195 # b"TypeValue = typing___NewType('TypeValue', builtin___int)" -third_party/2and3/google/protobuf/any_pb2.pyi -third_party/2and3/google/protobuf/api_pb2.pyi -third_party/2and3/google/protobuf/compiler/plugin_pb2.pyi -third_party/2and3/google/protobuf/descriptor.pyi -third_party/2and3/google/protobuf/descriptor_pb2.pyi -third_party/2and3/google/protobuf/duration_pb2.pyi -third_party/2and3/google/protobuf/empty_pb2.pyi -third_party/2and3/google/protobuf/field_mask_pb2.pyi -third_party/2and3/google/protobuf/internal/containers.pyi -third_party/2and3/google/protobuf/internal/enum_type_wrapper.pyi -third_party/2and3/google/protobuf/internal/extension_dict.pyi -third_party/2and3/google/protobuf/json_format.pyi -third_party/2and3/google/protobuf/message.pyi -third_party/2and3/google/protobuf/message_factory.pyi -third_party/2and3/google/protobuf/service.pyi -third_party/2and3/google/protobuf/source_context_pb2.pyi -third_party/2and3/google/protobuf/struct_pb2.pyi -third_party/2and3/google/protobuf/symbol_database.pyi -third_party/2and3/google/protobuf/timestamp_pb2.pyi -third_party/2and3/google/protobuf/type_pb2.pyi -third_party/2and3/google/protobuf/util/json_format_pb2.pyi -third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi -third_party/2and3/google/protobuf/wrappers_pb2.pyi +stubs/protobuf/google/protobuf/any_pb2.pyi +stubs/protobuf/google/protobuf/api_pb2.pyi +stubs/protobuf/google/protobuf/compiler/plugin_pb2.pyi +stubs/protobuf/google/protobuf/descriptor.pyi +stubs/protobuf/google/protobuf/descriptor_pb2.pyi +stubs/protobuf/google/protobuf/duration_pb2.pyi +stubs/protobuf/google/protobuf/empty_pb2.pyi +stubs/protobuf/google/protobuf/field_mask_pb2.pyi +stubs/protobuf/google/protobuf/internal/containers.pyi +stubs/protobuf/google/protobuf/internal/enum_type_wrapper.pyi +stubs/protobuf/google/protobuf/internal/extension_dict.pyi +stubs/protobuf/google/protobuf/json_format.pyi +stubs/protobuf/google/protobuf/message.pyi +stubs/protobuf/google/protobuf/message_factory.pyi +stubs/protobuf/google/protobuf/service.pyi +stubs/protobuf/google/protobuf/source_context_pb2.pyi +stubs/protobuf/google/protobuf/struct_pb2.pyi +stubs/protobuf/google/protobuf/symbol_database.pyi +stubs/protobuf/google/protobuf/timestamp_pb2.pyi +stubs/protobuf/google/protobuf/type_pb2.pyi +stubs/protobuf/google/protobuf/util/json_format_pb2.pyi +stubs/protobuf/google/protobuf/util/json_format_proto3_pb2.pyi +stubs/protobuf/google/protobuf/wrappers_pb2.pyi diff --git a/python/helpers/typeshed/tests/pytype_test.py b/python/helpers/typeshed/tests/pytype_test.py index 8f3666480f26..817fc854f3bd 100644 --- a/python/helpers/typeshed/tests/pytype_test.py +++ b/python/helpers/typeshed/tests/pytype_test.py @@ -12,14 +12,14 @@ will also discover incorrect usage of imported modules. import argparse import os -import re import sys import traceback -from typing import List, Match, Optional, Sequence, Tuple +from typing import List, Optional, Sequence, Tuple from pytype import config as pytype_config, load_pytd +from pytype.pytd import typeshed -TYPESHED_SUBDIRS = ["stdlib", "third_party"] +TYPESHED_SUBDIRS = ["stdlib", "stubs"] TYPESHED_HOME = "TYPESHED_HOME" @@ -33,6 +33,8 @@ def main() -> None: typeshed_location = args.typeshed_location or os.getcwd() subdir_paths = [os.path.join(typeshed_location, d) for d in TYPESHED_SUBDIRS] check_subdirs_discoverable(subdir_paths) + old_typeshed_home = os.environ.get(TYPESHED_HOME, UNSET) + os.environ[TYPESHED_HOME] = typeshed_location files_to_test = determine_files_to_test(typeshed_location=typeshed_location, paths=args.files or subdir_paths) run_all_tests( files_to_test=files_to_test, @@ -40,6 +42,10 @@ def main() -> None: print_stderr=args.print_stderr, dry_run=args.dry_run, ) + if old_typeshed_home is UNSET: + del os.environ[TYPESHED_HOME] + else: + os.environ[TYPESHED_HOME] = old_typeshed_home def create_parser() -> argparse.ArgumentParser: @@ -61,31 +67,6 @@ def create_parser() -> argparse.ArgumentParser: return parser -class PathMatcher: - def __init__(self, patterns: Sequence[str]) -> None: - patterns = [re.escape(os.path.join(*x.split("/"))) for x in patterns] - self.matcher = re.compile(r"({})$".format("|".join(patterns))) if patterns else None - - def search(self, path: str) -> Optional[Match[str]]: - if not self.matcher: - return None - return self.matcher.search(path) - - -def load_exclude_list(typeshed_location: str) -> List[str]: - filename = os.path.join(typeshed_location, "tests", "pytype_exclude_list.txt") - skip_re = re.compile(r"^\s*([^\s#]+)\s*(?:#.*)?$") - skip = [] - - with open(filename) as f: - for line in f: - skip_match = skip_re.match(line) - if skip_match: - skip.append(skip_match.group(1)) - - return skip - - def run_pytype(*, filename: str, python_version: str, typeshed_location: str) -> Optional[str]: """Runs pytype, returning the stderr if any.""" if python_version not in _LOADERS: @@ -94,8 +75,6 @@ def run_pytype(*, filename: str, python_version: str, typeshed_location: str) -> loader = load_pytd.create_loader(options) _LOADERS[python_version] = (options, loader) options, loader = _LOADERS[python_version] - old_typeshed_home = os.environ.get(TYPESHED_HOME, UNSET) - os.environ[TYPESHED_HOME] = typeshed_location try: with pytype_config.verbosity_from(options): ast = loader.load_file(_get_module_name(filename), filename) @@ -104,10 +83,6 @@ def run_pytype(*, filename: str, python_version: str, typeshed_location: str) -> stderr = traceback.format_exc() else: stderr = None - if old_typeshed_home is UNSET: - del os.environ[TYPESHED_HOME] - else: - os.environ[TYPESHED_HOME] = old_typeshed_home return stderr @@ -125,7 +100,15 @@ def _get_relative(filename: str) -> str: def _get_module_name(filename: str) -> str: """Converts a filename {subdir}/m.n/module/foo to module.foo.""" - return ".".join(_get_relative(filename).split(os.path.sep)[2:]).replace(".pyi", "").replace(".__init__", "") + parts = _get_relative(filename).split(os.path.sep) + if "@python2" in parts: + module_parts = parts[parts.index("@python2") + 1:] + elif parts[0] == "stdlib": + module_parts = parts[1:] + else: + assert parts[0] == "stubs" + module_parts = parts[2:] + return ".".join(module_parts).replace(".pyi", "").replace(".__init__", "") def _is_version(path: str, version: str) -> bool: @@ -142,20 +125,17 @@ def determine_files_to_test(*, typeshed_location: str, paths: Sequence[str]) -> """Determine all files to test, checking if it's in the exclude list and which Python versions to use. Returns a list of pairs of the file path and Python version as an int.""" - skipped = PathMatcher(load_exclude_list(typeshed_location)) filenames = find_stubs_in_paths(paths) + ts = typeshed.Typeshed() + skipped = set(ts.read_blacklist()) files = [] for f in sorted(filenames): rel = _get_relative(f) - if skipped.search(rel): + if rel in skipped: continue - if _is_version(f, "2and3"): - files.append((f, 2)) - files.append((f, 3)) - elif _is_version(f, "2"): - files.append((f, 2)) - elif _is_version(f, "3"): - files.append((f, 3)) + versions = ts.get_python_major_versions(rel) + if versions: + files.extend((f, v) for v in versions) else: print("Unrecognized path: {}".format(f)) return files @@ -178,10 +158,11 @@ def run_all_tests(*, files_to_test: Sequence[Tuple[str, int]], typeshed_location total_tests = len(files_to_test) print("Testing files with pytype...") for i, (f, version) in enumerate(files_to_test): + python_version = "2.7" if version == 2 else "{0.major}.{0.minor}".format(sys.version_info) stderr = ( run_pytype( filename=f, - python_version="2.7" if version == 2 else "{0.major}.{0.minor}".format(sys.version_info), + python_version=python_version, typeshed_location=typeshed_location, ) if not dry_run @@ -192,15 +173,15 @@ def run_all_tests(*, files_to_test: Sequence[Tuple[str, int]], typeshed_location print(stderr) errors += 1 stacktrace_final_line = stderr.rstrip().rsplit("\n", 1)[-1] - bad.append((_get_relative(f), stacktrace_final_line)) + bad.append((_get_relative(f), python_version, stacktrace_final_line)) runs = i + 1 if runs % 25 == 0: print(" {:3d}/{:d} with {:3d} errors".format(runs, total_tests, errors)) print("Ran pytype with {:d} pyis, got {:d} errors.".format(total_tests, errors)) - for f, err in bad: - print("{}: {}".format(f, err)) + for f, v, err in bad: + print("{} ({}): {}".format(f, v, err)) if errors: raise SystemExit("\nRun again with --print-stderr to get the full stacktrace.") diff --git a/python/helpers/typeshed/tests/stubtest_whitelists/py39.txt b/python/helpers/typeshed/tests/stubtest_whitelists/py39.txt index 9f4afe54d248..9e57bb608917 100644 --- a/python/helpers/typeshed/tests/stubtest_whitelists/py39.txt +++ b/python/helpers/typeshed/tests/stubtest_whitelists/py39.txt @@ -118,6 +118,8 @@ typing.SupportsInt.__init__ typing.SupportsRound.__init__ typing._SpecialForm.__init__ typing._TypedDict.__delitem__ +typing._TypedDict.__ior__ +typing._TypedDict.__or__ typing._TypedDict.copy typing._TypedDict.items typing._TypedDict.keys diff --git a/python/helpers/typeshed/tests/stubtest_whitelists/py3_common.txt b/python/helpers/typeshed/tests/stubtest_whitelists/py3_common.txt index 2fb874204cc0..698b3d14aee0 100644 --- a/python/helpers/typeshed/tests/stubtest_whitelists/py3_common.txt +++ b/python/helpers/typeshed/tests/stubtest_whitelists/py3_common.txt @@ -76,6 +76,13 @@ bz2.BZ2File.readinto bz2.BZ2File.readlines bz2.BZ2File.write bz2.BZ2File.writelines +# The following methods were changed in point releases from Python 3.6 to 3.9 +# as part of a security fix. These excludes can be removed when the GitHub +# action workflow uses Python versions that include the fix (adding a +# separator argument). +cgi.FieldStorage.__init__ +cgi.parse +cgi.parse_multipart codecs.BufferedIncrementalDecoder.decode codecs.CodecInfo.decode codecs.CodecInfo.encode @@ -382,6 +389,7 @@ threading.Thread.__init__ timeit.main tkinter.Misc.grid_propagate tkinter.Misc.pack_propagate +tkinter.Tk.eval # from __getattr__ tkinter.Tk.report_callback_exception # A bit of a lie, since it's actually a method, but typing it as an attribute allows it to be assigned to tkinter.Wm.wm_iconphoto # Default value of argument can't be used without runtime error tkinter.font.Font.__getitem__ # Argument name differs (doesn't matter for __dunder__ methods) @@ -405,6 +413,12 @@ unittest.mock.patch # It's a complicated overload and I haven't been able to fi urllib.error.ContentTooShortError.__init__ urllib.error.URLError.__init__ urllib.parse._DefragResultBase.__new__ +# The following methods were changed in point releases from Python 3.6 to 3.9 +# as part of a security fix. These excludes can be removed when the GitHub +# action workflow uses Python versions that include the fix (adding a +# separator argument). +urllib.parse.parse_qs +urllib.parse.parse_qsl urllib.request.BaseHandler.http_error_nnn urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ urllib.robotparser.RobotFileParser.can_fetch diff --git a/python/helpers/typeshed/third_party/2and3/cachetools/decorators.pyi b/python/helpers/typeshed/third_party/2and3/cachetools/decorators.pyi deleted file mode 100644 index 4cd437483bf3..000000000000 --- a/python/helpers/typeshed/third_party/2and3/cachetools/decorators.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Any, Callable, ContextManager, MutableMapping, Optional, TypeVar - -_KT = TypeVar("_KT") -_VT = TypeVar("_VT") -_T = TypeVar("_T", bound=Callable[..., Any]) -_T_co = TypeVar("_T_co", covariant=True) -_T_self = TypeVar("_T_self") - -def cached( - cache: Optional[MutableMapping[_KT, _VT]], key: Callable[..., _KT] = ..., lock: Optional[ContextManager[_T_co]] = ... -) -> Callable[[_T], _T]: ... -def cachedmethod( - cache: Callable[[_T_self], Optional[MutableMapping[_KT, _VT]]], - key: Callable[..., _KT] = ..., - lock: Optional[ContextManager[_T_co]] = ..., -) -> Callable[[_T], _T]: ... diff --git a/python/python-psi-impl/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt b/python/python-psi-impl/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt index 8bf714b02284..9586f5fd7aac 100644 --- a/python/python-psi-impl/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt +++ b/python/python-psi-impl/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt @@ -37,8 +37,6 @@ import java.io.File * @author vlan */ object PyTypeShed { - private const val ONLY_SUPPORTED_PY2_MINOR = 7 - private val SUPPORTED_PY3_MINORS = LanguageLevel.SUPPORTED_LEVELS.filter { it.isPy3K }.map { it.minorVersion } /** * Returns true if we allow to search typeshed for a stub for [name]. @@ -68,34 +66,21 @@ object PyTypeShed { */ fun findRootsForSdk(sdk: Sdk): List { val level = PythonRuntimeService.getInstance().getLanguageLevelForSdk(sdk) - val dir = directory ?: return emptyList() return findRootsForLanguageLevel(level) - .asSequence() - .map { dir.findFileByRelativePath(it) } - .filterNotNull() - .toList() } /** * Returns the list of roots in typeshed for the specified Python language [level]. */ - fun findRootsForLanguageLevel(level: LanguageLevel): List { - val majorVersion = level.majorVersion - val minorVersion = level.minorVersion + fun findRootsForLanguageLevel(level: LanguageLevel): List { + val dir = directory ?: return emptyList() - val minors = when (majorVersion) { - 2 -> listOf(ONLY_SUPPORTED_PY2_MINOR) - 3 -> SUPPORTED_PY3_MINORS.reversed().filter { it <= minorVersion } - else -> return emptyList() - } + val common = sequenceOf(dir.findChild("stdlib")) + .plus(dir.findFileByRelativePath("stubs")?.children ?: VirtualFile.EMPTY_ARRAY) + .filterNotNull() + .toList() - return minors.map { "stdlib/$majorVersion.$it" } + - listOf( - "stdlib/$majorVersion", - "stdlib/2and3", - "third_party/$majorVersion", - "third_party/2and3" - ) + return if (level.isPython2) common.flatMap { listOfNotNull(it.findChild("@python2"), it) } else common } /** @@ -114,7 +99,7 @@ object PyTypeShed { StandardFileSystems.local().findFileByPath(path) } - val directoryPath: String? + private val directoryPath: String? get() { val paths = listOf("${PathManager.getConfigPath()}/typeshed", "${PathManager.getConfigPath()}/../typeshed", @@ -127,7 +112,7 @@ object PyTypeShed { /** * A shallow check for a [file] being located inside the typeshed third-party stubs. */ - fun isInThirdPartyLibraries(file: VirtualFile): Boolean = "third_party" in file.path + fun isInThirdPartyLibraries(file: VirtualFile): Boolean = "stubs" in file.path fun isInStandardLibrary(file: VirtualFile): Boolean = "stdlib" in file.path } diff --git a/python/testData/inspections/PyTypeCheckerInspection/BuiltinsPy3.py b/python/testData/inspections/PyTypeCheckerInspection/BuiltinsPy3.py index f5adbbdea6ec..863d6912cfdc 100644 --- a/python/testData/inspections/PyTypeCheckerInspection/BuiltinsPy3.py +++ b/python/testData/inspections/PyTypeCheckerInspection/BuiltinsPy3.py @@ -13,4 +13,4 @@ def test_numerics(): divmod(False, False) divmod(b'foo', 'bar') pow(False, True) - round(False, 'foo') + round(False, 'foo') diff --git a/python/testData/typeshed/.gitignore b/python/testData/typeshed/.gitignore deleted file mode 100644 index 8c36c4298d21..000000000000 --- a/python/testData/typeshed/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.cache diff --git a/python/testData/typeshed/conftest.py b/python/testData/typeshed/conftest.py deleted file mode 100644 index 1fdcd76f313d..000000000000 --- a/python/testData/typeshed/conftest.py +++ /dev/null @@ -1,14 +0,0 @@ -import re -import os -import pip -import pytest - - -@pytest.fixture(scope='module') -def requirements(request): - requirements_path = re.sub(r'(.*)_test\.py', r'\1_requirements.txt', - request.module.__file__) - if os.path.exists(requirements_path): - pip.main(['install', '-r', requirements_path]) - yield - # We could uninstall everything here after the module tests finish diff --git a/python/testData/typeshed/pytest.ini b/python/testData/typeshed/pytest.ini deleted file mode 100644 index c32d44d0f1f1..000000000000 --- a/python/testData/typeshed/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -usefixtures = requirements tmpdir diff --git a/python/testData/typeshed/stdlib/2/builtins_test.py b/python/testData/typeshed/stdlib/2/builtins_test.py deleted file mode 100644 index 7aab7b32c1a8..000000000000 --- a/python/testData/typeshed/stdlib/2/builtins_test.py +++ /dev/null @@ -1,206 +0,0 @@ -def test_map(): - assert map(str, [1, 2, 3]) + ['foo'] == ['1', '2', '3', 'foo'] - assert map(lambda x: x.upper(), 'foo').pop() == 'O' - - -def test_filter(): - assert filter(lambda x: x % 2 == 0, [1, 2, 3]) + [4, 5, 6] == [2, 4, 5, 6] - assert filter(lambda x: x != 'f', 'foo') + 'bar' == 'oobar' - - -def test_open(tmpdir): - path = tmpdir.join('foo') - path.write('test') - with open(str(path), 'r') as fd: - assert '\n'.join(fd.xreadlines()) == 'test' - - -def test_zip(): - assert(list(zip([1])) == [(1,)]) - assert(list(zip([1], [2])) == [(1, 2,)]) - assert(list(zip([1], [2], [3])) == [(1, 2, 3)]) - assert(list(zip([1], [2], [3], [4])) == [(1, 2, 3, 4)]) - assert(list(zip([1], [2], [3], [4], [5])) == [(1, 2, 3, 4, 5)]) - assert(list(zip([1], [2], [3], [4], [5], [6])) == [(1, 2, 3, 4, 5, 6)]) - assert(list(zip([1], [2], [3], [4], [5], [6], [7])) == [(1, 2, 3, 4, 5, 6, 7)]) - assert(list(zip([1], [2], [3], [4], [5], [6], [7], [8])) == [(1, 2, 3, 4, 5, 6, 7, 8)]) - assert(list(zip([1], [2], [3], [4], [5], [6], [7], [8], [9])) == [(1, 2, 3, 4, 5, 6, 7, 8, 9)]) - assert(list(zip([1], [2], [3], [4], [5], [6], [7], [8], [10])) == [(1, 2, 3, 4, 5, 6, 7, 8, 10)]) - - -def test_classmethod(): - # test __init__ - def a(): - pass - - assert isinstance(classmethod(a), classmethod) - - - # test __new__ - def b(): - pass - - - def c(): - pass - - - def d(): - pass - - - def e(): - pass - - - assert isinstance(classmethod.__new__(classmethod, b, c, d=d, e=e), classmethod) - - - # test __func__ - def f(): - pass - - - assert classmethod(f).__func__ == f - - - # test __get__ - class WrappedWithSM: - @classmethod - def foo(cls): - return 10 - - - class ReassignedWithSM: - def foo(cls): - return 10 - foo = classmethod(foo) - - - assert type(WrappedWithSM.__dict__["foo"].__get__(WrappedWithSM, type)).__name__ == "instancemethod" - assert type(WrappedWithSM.__dict__["foo"].__get__(WrappedWithSM)).__name__ == "instancemethod" - assert type(ReassignedWithSM.__dict__["foo"].__get__(ReassignedWithSM, type)).__name__ == "instancemethod" - assert type(ReassignedWithSM.__dict__["foo"].__get__(ReassignedWithSM)).__name__ == "instancemethod" - - - # test __getattribute__ - def g(): - pass - - - assert classmethod(g).__getattribute__("__func__") == g - - - # test __dict__.keys() - assert set(classmethod.__dict__.keys()) == {'__init__', '__new__', '__func__', '__get__', '__getattribute__', '__doc__'} - - -def test_staticmethod(): - # test __init__ - def a(): - pass - - assert isinstance(staticmethod(a), staticmethod) - - - # test __new__ - def b(): - pass - - - def c(): - pass - - - def d(): - pass - - - def e(): - pass - - - assert isinstance(staticmethod.__new__(staticmethod, b, c, d=d, e=e), staticmethod) - - - # test __func__ - def f(): - pass - - - assert staticmethod(f).__func__ == f - - - # test __get__ - class WrappedWithSM: - @staticmethod - def foo(): - return 10 - - - class ReassignedWithSM: - def foo(): - return 10 - foo = staticmethod(foo) - - - assert type(WrappedWithSM.__dict__["foo"].__get__(WrappedWithSM, type)).__name__ == "function" - assert type(WrappedWithSM.__dict__["foo"].__get__(WrappedWithSM)).__name__ == "function" - assert type(ReassignedWithSM.__dict__["foo"].__get__(ReassignedWithSM, type)).__name__ == "function" - assert type(ReassignedWithSM.__dict__["foo"].__get__(ReassignedWithSM)).__name__ == "function" - - - # test __getattribute__ - def g(): - pass - - - assert staticmethod(g).__getattribute__("__func__") == g - - - # test __dict__.keys() - assert set(staticmethod.__dict__.keys()) == {'__init__', '__new__', '__func__', '__get__', '__getattribute__', '__doc__'} - - -def test_str_init_new(): - class A: - def __str__(self): - return "A" - - assert str.__new__(str) is not None - assert str.__new__(str, A()) is not None - assert str.__new__(str, b"foo") is not None - assert str.__new__(str, u"foo") is not None - - assert str() is not None - assert str(A()) is not None - assert str(b"foo") is not None - assert str(u"foo") is not None - - -def test_int_init_new(): - class A: - def __int__(self): - return 5 - - assert int.__new__(int) is not None - assert int.__new__(int, A()) is not None - assert int.__new__(int, u"100") is not None - assert int.__new__(int, b"100") is not None - assert int.__new__(int, u"100", 2) is not None - assert int.__new__(int, b"100", 2) is not None - - assert int() is not None - assert int(A()) is not None - assert int(u"100") is not None - assert int(b"100") is not None - assert int(u"100", 2) is not None - assert int(b"100", 2) is not None - - -def test_dict_update(): - d = {} - d.update({"k1": 1, "v1": 1}) - d.update([("k2", 2), ("v2", 2)]) - d.update(k3=3, v3=3) - assert d == {"k1": 1, "v1": 1, "k2": 2, "v2": 2, "k3": 3, "v3": 3} diff --git a/python/testData/typeshed/stdlib/2/collections_test.py b/python/testData/typeshed/stdlib/2/collections_test.py deleted file mode 100644 index b71032c3ff1a..000000000000 --- a/python/testData/typeshed/stdlib/2/collections_test.py +++ /dev/null @@ -1,169 +0,0 @@ -def test_namedtuple(): - from collections import namedtuple - - assert namedtuple("Point", "x y")(1, 2).x == 1 - assert namedtuple(u"Point", u"x y", verbose=False, rename=False)(1, 2).x == 1 - assert namedtuple(b"Point", b"x y", verbose=True, rename=True)(1, 2).x == 1 - - assert namedtuple("Point", ["x", "y"])(1, 2).x == 1 - assert namedtuple(u"Point", [u"x", u"y"])(1, 2).x == 1 - assert namedtuple(b"Point", [b"x", b"y"])(1, 2).x == 1 - - assert namedtuple("Point", [b"x", u"y"])(1, 2).x == 1 - - Point = namedtuple('Point', 'x y') - p = Point(1, 2) - - assert p == Point(1, 2) - - assert p._replace(y=3.14).y == 3.14 - assert p._asdict()['x'] == 1 - assert p._fields == ('x', 'y') - - assert p == (1, 2) - assert (p.x, p.y) == (1, 2) - assert p[0] + p[1] == 3 - assert p.index(1) == 0 - - assert Point._make([1, 3.14]).y == 3.14 - - -def test_deque(): - from collections import deque - - d = deque([2]) - assert list(deque([1, 2, 3])) == [1, 2, 3] - assert list(deque([1, 2, 3], 2)) == [2, 3] - - assert deque([1, 2, 3]).maxlen is None - assert deque([1, 2, 3], 2).maxlen == 2 - - d.append(3) - d.appendleft(1) - assert list(d) == [1, 2, 3] - - d.clear() - assert len(d) == 0 - - d.extend([1, 2, 3]) - d.extendleft([5, 3, 1]) - assert d.count(3) == 2 - assert list(d) == [1, 3, 5, 1, 2, 3] - - assert d.pop() == 3 - assert d.popleft() == 1 - d.remove(5) - assert list(d) == [3, 1, 2] - - d.reverse() - assert list(d) == [2, 1, 3] - d.rotate(1) - assert list(d) == [3, 2, 1] - d.rotate(-2) - assert list(d) == [1, 3, 2] - - assert len(d) == 3 - assert 3 in d - assert d[1] == 3 - d[1] = 4 - assert list(d) == [1, 4, 2] - - assert list(reversed(d)) == [2, 4, 1] - - -def test_counter(): - from collections import Counter - - c = Counter() - assert Counter("abc") == {"a": 1, "b": 1, "c": 1} - assert Counter({"a": 1, "b": 2, "c": 3}) == {"a": 1, "b": 2, "c": 3} - assert Counter(a=1, b=2, c=3) == {"a": 1, "b": 2, "c": 3} - - c["abc"] = 1 - c["def"] = 2 - assert c == {"abc": 1, "def": 2} - - c["def"] = 0 - assert c == {"abc": 1, "def": 0} - del c["def"] - - assert c["ghi"] == 0 - - c.update({"ghi": 2}) - assert list(c.elements()) == ["abc", "ghi", "ghi"] - - c.update(["a", "a", "b", "a", "a", "a", "b", "a"]) - assert c == {"abc": 1, "ghi": 2, "a": 6, "b": 2} - - c.update(a=-3, b=-1) - assert c == {"abc": 1, "ghi": 2, "a": 3, "b": 1} - - assert c.most_common(2) == [("a", 3), ("ghi", 2)] - assert c.most_common() == [("a", 3), ("ghi", 2), ("abc", 1), ("b", 1)] - c.subtract({"abc": 1, "ghi": -2, "a": 3, "b": -1}) - assert c == {"abc": 0, "ghi": 4, "a": 0, "b": 2} - - c = Counter(a=3, b=1) - d = Counter(a=1, b=2) - assert c + d == Counter({'a': 4, 'b': 3}) - assert c - d == Counter({'a': 2}) - assert c & d == Counter({'a': 1, 'b': 1}) - assert c | d == Counter({'a': 3, 'b': 2}) - - c = Counter(a=3, b=1) - c += d - assert c == Counter({'a': 4, 'b': 3}) - - c = Counter(a=3, b=1) - c -= d - assert c == Counter({'a': 2}) - - c = Counter(a=3, b=1) - c &= d - assert c == Counter({'a': 1, 'b': 1}) - - c = Counter(a=3, b=1) - c |= d - assert c == Counter({'a': 3, 'b': 2}) - - c = Counter(a=3, b=1) - c.subtract(["a", "b"]) - assert c == {"a": 2, "b": 0} - - -def test_ordered_dict(): - from collections import OrderedDict - - od = OrderedDict([("a", 1), ("b", 2), ("c", 3), ("d", 4)]) - assert od.popitem() == ("d", 4) - assert od == OrderedDict([("a", 1), ("b", 2), ("c", 3)]) - assert od.popitem(last=False) == ("a", 1) - assert od == OrderedDict([("b", 2), ("c", 3)]) - assert od.popitem(last=True) == ("c", 3) - assert od == OrderedDict([("b", 2)]) - assert od == {"b": 2} - - -def test_defaultdict(): - from collections import defaultdict - - assert defaultdict() == {} - assert defaultdict(k1=1, k2=2) == {"k1": 1, "k2": 2} - - assert defaultdict(lambda: 1) == {} - assert defaultdict(lambda: 2, {"k1": 1, "k2": 2}) == {"k1": 1, "k2": 2} - assert defaultdict(lambda: 3, [("k1", 1), ("k2", 2)]) == {"k1": 1, "k2": 2} - - assert defaultdict(None) == {} - assert defaultdict(None, {"k1": 1, "k2": 2}) == {"k1": 1, "k2": 2} - assert defaultdict(None, [("k1", 1), ("k2", 2)]) == {"k1": 1, "k2": 2} - - assert defaultdict(lambda: 4).__missing__("key") == 4 - - -def test_abc(): - from collections import (Container, Hashable, Iterable, Iterator, Sized, Callable, Sequence, MutableSequence, Set, - MutableSet, Mapping, MutableMapping, MappingView, ItemsView, KeysView, ValuesView) - - assert [Container, Hashable, Iterable, Iterator, Sized, Callable, Sequence, MutableSequence, Set, MutableSet, - Mapping, MutableMapping, MappingView, ItemsView, KeysView, ValuesView] \ No newline at end of file diff --git a/python/testData/typeshed/stdlib/2/datetime_test.py b/python/testData/typeshed/stdlib/2/datetime_test.py deleted file mode 100644 index 3fb41bdfddfc..000000000000 --- a/python/testData/typeshed/stdlib/2/datetime_test.py +++ /dev/null @@ -1,211 +0,0 @@ -def test_date(): - from datetime import date, timedelta - - d = date(2000, 12, 15) - - assert d.min == date(1, 1, 1) - assert d.max == date(9999, 12, 31) - assert d.resolution == timedelta(1) - - assert date.fromtimestamp(2048) == date(1970, 1, 1) - assert isinstance(date.today(), date) - assert date.fromordinal(2048) == date(6, 8, 10) - - assert d.year == 2000 - assert d.month == 12 - assert d.day == 15 - - assert d.ctime() == "Fri Dec 15 00:00:00 2000" - assert d.strftime("%d") == "15" - assert format(d, "%d") == "15" - assert d.isoformat() == "2000-12-15" - assert [d.timetuple()[i] for i in range(3)] == [2000, 12, 15] - assert d.toordinal() == 730469 - - assert d.replace() == date(2000, 12, 15) - assert d.replace(2001) == date(2001, d.month, d.day) - assert d.replace(2001, 11) == date(2001, 11, d.day) - assert d.replace(2001, 11, 16) == date(2001, 11, 16) - - assert d < date(2000, 12, 16) - assert d <= date(2000, 12, 15) - assert d > date(2000, 12, 14) - assert d >= date(2000, 12, 15) - - assert d + timedelta(3) == date(2000, 12, 18) - assert d - timedelta(3) == date(2000, 12, 12) - assert d - date(2000, 6, 8) == timedelta(190) - - assert d.weekday() == 4 - assert d.isoweekday() == 5 - assert d.isocalendar() == (2000, 50, 5) - - -def test_time(): - from datetime import time, timedelta - - time() - time(23) - - t1 = time(23, 25) - t = time(23, 25, 30) - t2 = time(23, 25, 30, 50) - - assert t.min == time() - assert t.max == time(23, 59, 59, 999999) - assert t.resolution == timedelta(microseconds=1) - - assert t.hour == 23 - assert t.minute == 25 - assert t.second == 30 - assert t.microsecond == 0 - assert t.tzinfo is None - - assert t < t2 - assert t <= time(23, 25, 30) - assert t > t1 - assert t >= time(23, 25, 30) - - assert t.isoformat() == "23:25:30" - assert t.strftime("%m") == "01" - assert format(t, "%m") == "01" - - assert t.utcoffset() is None - assert t.tzname() is None - assert t.dst() is None - - assert t.replace(22) == time(22, t.minute, t.second) - assert t.replace(22, 24) == time(22, 24, t.second) - assert t.replace(22, 24, 29) == time(22, 24, 29) - - t3 = time(23, 25, 20, tzinfo=None) - assert t3.tzinfo is None - assert t3.replace(tzinfo=None).tzinfo is None - - -def test_timedelta(): - from datetime import timedelta - - timedelta() - timedelta(5) - timedelta(5, 6) - timedelta(5, 6, 7) - timedelta(5, 6, 7, 8) - timedelta(5, 6, 7, 8, 9) - timedelta(5, 6, 7, 8, 9, 10) - timedelta(5, 6, 7, 8, 9, 10, 11) - - td1 = timedelta(hours=1, minutes=10, seconds=10) - td = timedelta(hours=1, minutes=10, seconds=20) - td2 = timedelta(hours=1, minutes=10, seconds=30) - - assert td.min == timedelta(days=-999999999) - assert td.max == timedelta(days=999999999, hours=23, minutes=59, seconds=59, microseconds=999999) - assert td.resolution == timedelta(microseconds=1) - - assert td.days == 0 - assert td.seconds == 4220 - assert td.microseconds == 0 - - assert td.total_seconds() == 4220 - - assert td + td1 == timedelta(hours=2, minutes=20, seconds=30) - assert td2 - td == timedelta(seconds=10) - - assert -td == timedelta(days=-1, hours=22, minutes=49, seconds=40) - assert +td == td - - assert abs(td) == td - - assert td.__mul__(2) == timedelta(hours=2, minutes=20, seconds=40) - assert td.__rmul__(2) == timedelta(hours=2, minutes=20, seconds=40) - - assert td.__floordiv__(2) == timedelta(minutes=35, seconds=10) - assert td.__floordiv__(timedelta(minutes=5)) == NotImplemented - - assert td.__div__(2) == timedelta(minutes=35, seconds=10) - assert td.__div__(timedelta(minutes=5)) == NotImplemented - - assert td < td2 - assert td <= timedelta(hours=1, minutes=10, seconds=20) - assert td > td1 - assert td >= timedelta(hours=1, minutes=10, seconds=20) - - -def test_datetime(): - from datetime import datetime, timedelta, date, time - - datetime(2000, 12, 25) - datetime(2000, 12, 25, 23) - datetime(2000, 12, 25, 23, 59) - datetime(2000, 12, 25, 23, 59, 59) - datetime(2000, 12, 25, 23, 59, 59, 60) - dt1 = datetime(2000, 12, 24, 23, 59, 59) - dt = datetime(2000, 12, 25, 23, 59, 59) - dt2 = datetime(2000, 12, 26, 23, 59, 59) - - assert dt.min == datetime(1, 1, 1) - assert dt.max == datetime(9999, 12, 31, 23, 59, 59, 999999) - assert dt.resolution == timedelta(microseconds=1) - - assert dt.year == 2000 - assert dt.month == 12 - assert dt.day == 25 - assert dt.hour == 23 - assert dt.minute == 59 - assert dt.second == 59 - assert dt.microsecond == 0 - assert dt.tzinfo is None - - assert datetime.utcfromtimestamp(2048) == datetime(1970, 1, 1, 0, 34, 8) - assert isinstance(datetime.today(), datetime) - assert datetime.fromordinal(2048) == datetime(6, 8, 10) - assert isinstance(datetime.utcnow(), datetime) - assert datetime.combine(date(2000, 12, 25), time(23, 59, 59)) == dt - assert datetime.strptime("2000 12 25 23 59 59", "%Y %m %d %H %M %S") == dt - - assert dt.strftime("%Y %m %d %H %M %S") == "2000 12 25 23 59 59" - assert format(dt, "%Y %m %d %H %M %S") == "2000 12 25 23 59 59" - - assert dt.toordinal() == 730479 - assert [dt.timetuple()[i] for i in range(6)] == [2000, 12, 25, 23, 59, 59] - assert [dt.utctimetuple()[i] for i in range(6)] == [2000, 12, 25, 23, 59, 59] - assert dt.date() == date(2000, 12, 25) - assert dt.time() == time(23, 59, 59) - assert dt.timetz() == time(23, 59, 59) - assert dt.ctime() == "Mon Dec 25 23:59:59 2000" - assert dt.isoformat() == "2000-12-25T23:59:59" - assert dt.utcoffset() is None - assert dt.tzname() is None - assert dt.dst() is None - assert dt.weekday() == 0 - assert dt.isoweekday() == 1 - assert dt.isocalendar() == (2000, 52, 1) - - assert dt.replace(2001) == datetime(2001, dt.month, dt.day, dt.hour, dt.minute, dt.second) - assert dt.replace(2001, 11) == datetime(2001, 11, dt.day, dt.hour, dt.minute, dt.second) - assert dt.replace(2001, 11, 24) == datetime(2001, 11, 24, dt.hour, dt.minute, dt.second) - assert dt.replace(2001, 11, 24, 22) == datetime(2001, 11, 24, 22, dt.minute, dt.second) - assert dt.replace(2001, 11, 24, 22, 58) == datetime(2001, 11, 24, 22, 58, dt.second) - assert dt.replace(2001, 11, 24, 22, 58, 58) == datetime(2001, 11, 24, 22, 58, 58) - - assert dt < dt2 - assert dt <= datetime(2000, 12, 25, 23, 59, 59) - assert dt > dt1 - assert dt >= datetime(2000, 12, 25, 23, 59, 59) - - assert dt + timedelta(3) == datetime(2000, 12, 28, 23, 59, 59) - assert dt - timedelta(3) == datetime(2000, 12, 22, 23, 59, 59) - assert dt - dt1 == timedelta(1) - - assert datetime.fromtimestamp(2048, None) == datetime(1970, 1, 1, 3, 34, 8) - assert datetime.fromtimestamp(2048) == datetime(1970, 1, 1, 3, 34, 8) - - assert isinstance(datetime.now(None), datetime) - assert isinstance(datetime.now(), datetime) - - dt3 = datetime(2000, 12, 25, 15, 16, 17, tzinfo=None) - assert dt3.tzinfo is None - - dt4 = dt3.replace(tzinfo=None) - assert dt4.tzinfo is None \ No newline at end of file diff --git a/python/testData/typeshed/stdlib/2/types_test.py b/python/testData/typeshed/stdlib/2/types_test.py deleted file mode 100644 index b751c1294cda..000000000000 --- a/python/testData/typeshed/stdlib/2/types_test.py +++ /dev/null @@ -1,11 +0,0 @@ -def test_methodtype(): - import types - - - class A: - def foo(self): - return "ok" - - - assert types.UnboundMethodType(A.foo, A())() == "ok" - assert types.MethodType(A.foo, A())() == "ok" \ No newline at end of file diff --git a/python/testData/typeshed/stdlib/2/typing_test.py b/python/testData/typeshed/stdlib/2/typing_test.py deleted file mode 100644 index fb17d0e9fe71..000000000000 --- a/python/testData/typeshed/stdlib/2/typing_test.py +++ /dev/null @@ -1,12 +0,0 @@ -def test_namedtuple(): - from typing import NamedTuple - - nt1 = NamedTuple("nt1", [("x", str), ("y", int)]) - nt1_instance = nt1(x="str", y=5) - assert nt1_instance.x == "str" - assert nt1_instance.y == 5 - - nt2 = NamedTuple("nt2", x=str, y=int) - nt2_instance = nt2(x="str", y=5) - assert nt2_instance.x == "str" - assert nt2_instance.y == 5 \ No newline at end of file diff --git a/python/testData/typeshed/stdlib/2and3/builtins_test.py b/python/testData/typeshed/stdlib/2and3/builtins_test.py deleted file mode 100644 index fb37ff2c8688..000000000000 --- a/python/testData/typeshed/stdlib/2and3/builtins_test.py +++ /dev/null @@ -1,48 +0,0 @@ -def test_property(): - class C(object): - @property - def f(self): - # type: () -> C - return C() - - @f.setter - def f(self, value): - # type: (C) -> None - pass - - @f.deleter - def f(self): - # type: () -> None - pass - - c = C() - assert isinstance(c.f, C) - assert c.f is not None - assert c.f.f is not None - assert isinstance(C.f, property) - assert C.f.fget(c) is not None - assert C.f.fget(c).f - assert C.f.fset(c, c) is None - assert C.f.fdel(c) is None - - -def test_object_module(): - class C(object): - pass - - c = C() - - assert c.__module__ is not None - assert c.__module__.strip() == c.__module__ - assert C.__module__ is not None - assert object.__module__ is not None - assert type.__module__ is not None - - -def test_object_reduce(): - class C(object): - pass - - c = C() - assert isinstance(c.__reduce__(), (str, tuple)) - assert isinstance(c.__reduce_ex__(), (str, tuple)) diff --git a/python/testData/typeshed/stdlib/3.4/pathlib_test.py b/python/testData/typeshed/stdlib/3.4/pathlib_test.py deleted file mode 100644 index 8070fc31b2b0..000000000000 --- a/python/testData/typeshed/stdlib/3.4/pathlib_test.py +++ /dev/null @@ -1,32 +0,0 @@ -def test_pure_path(): - import sys - - if sys.version_info >= (3, 6): - import pathlib - - class A: - def __fspath__(self): - return "a.txt" - - assert pathlib.PurePath(A()).name == "a.txt" - - path = pathlib.PurePath(A(), A()) - assert path.name == "a.txt" - assert path.parent.name == "a.txt" - - -def test_path(): - import sys - - if sys.version_info >= (3, 6): - import pathlib - - class A: - def __fspath__(self): - return "a.txt" - - assert pathlib.Path(A()).name == "a.txt" - - path = pathlib.Path(A(), A()) - assert path.name == "a.txt" - assert path.parent.name == "a.txt" diff --git a/python/testData/typeshed/stdlib/3.6/typing_test.py b/python/testData/typeshed/stdlib/3.6/typing_test.py deleted file mode 100644 index e87b4caa0926..000000000000 --- a/python/testData/typeshed/stdlib/3.6/typing_test.py +++ /dev/null @@ -1,26 +0,0 @@ -def test_async_generator(): - import asyncio - from typing import TYPE_CHECKING - if TYPE_CHECKING: - from typing import AsyncGenerator, Any # AsyncGenerator is not yet in Python 3.6.0 available at the moment - - async def async_gen(): - # type: () -> AsyncGenerator[int, Any] - yield 0 - yield 1 - - async def f(): - gen = async_gen() - assert gen.__aiter__() == gen - assert await gen.__anext__() == 0 - assert gen.ag_await is None - assert gen.ag_frame is not None - assert not gen.ag_running - assert gen.ag_code is not None - - assert await gen.asend(0) == 1 - assert gen.aclose is not None - assert gen.athrow is not None - - loop = asyncio.get_event_loop() - loop.run_until_complete(f()) diff --git a/python/testData/typeshed/stdlib/3/builtins_test.py b/python/testData/typeshed/stdlib/3/builtins_test.py deleted file mode 100644 index 70c2b36a0305..000000000000 --- a/python/testData/typeshed/stdlib/3/builtins_test.py +++ /dev/null @@ -1,225 +0,0 @@ -def test_zip(): - assert(list(zip([1])) == [(1,)]) - assert(list(zip([1], [2])) == [(1, 2,)]) - assert(list(zip([1], [2], [3])) == [(1, 2, 3)]) - assert(list(zip([1], [2], [3], [4])) == [(1, 2, 3, 4)]) - assert(list(zip([1], [2], [3], [4], [5])) == [(1, 2, 3, 4, 5)]) - assert(list(zip([1], [2], [3], [4], [5], [6])) == [(1, 2, 3, 4, 5, 6)]) - assert(list(zip([1], [2], [3], [4], [5], [6], [7])) == [(1, 2, 3, 4, 5, 6, 7)]) - assert(list(zip([1], [2], [3], [4], [5], [6], [7], [8])) == [(1, 2, 3, 4, 5, 6, 7, 8)]) - assert(list(zip([1], [2], [3], [4], [5], [6], [7], [8], [9])) == [(1, 2, 3, 4, 5, 6, 7, 8, 9)]) - assert(list(zip([1], [2], [3], [4], [5], [6], [7], [8], [10])) == [(1, 2, 3, 4, 5, 6, 7, 8, 10)]) - - -def test_open_path_like(): - import sys - - if sys.version_info >= (3, 6): - class A: - def __fspath__(self): - return sys.argv[0] - - with open(A()) as f: - assert f.name == sys.argv[0] - - -def test_classmethod(): - import abc - - - # test __init__ - def a(): - pass - - - assert isinstance(classmethod(a), classmethod) - - - # test __new__ - def b(): - pass - - - def c(): - pass - - - def d(): - pass - - - def e(): - pass - - - assert isinstance(classmethod.__new__(classmethod, b, c, d=d, e=e), classmethod) - - - # test __func__ - def f(): - pass - - - assert classmethod(f).__func__ == f - - - # test __isabstractmethod__ - @abc.abstractmethod - def g(): - pass - - - def h(): - pass - - - assert classmethod(g).__isabstractmethod__ - assert not classmethod(h).__isabstractmethod__ - - - # test __get__ - class WrappedWithSM: - @classmethod - def foo(cls): - return 10 - - - class ReassignedWithSM: - def foo(cls): - return 10 - foo = classmethod(foo) - - - assert type(WrappedWithSM.__dict__["foo"].__get__(WrappedWithSM, type)).__name__ == "method" - assert type(WrappedWithSM.__dict__["foo"].__get__(WrappedWithSM)).__name__ == "method" - assert type(ReassignedWithSM.__dict__["foo"].__get__(ReassignedWithSM, type)).__name__ == "method" - assert type(ReassignedWithSM.__dict__["foo"].__get__(ReassignedWithSM)).__name__ == "method" - - - # test __dict__.keys() - assert set(classmethod.__dict__.keys()) == {'__init__', '__new__', '__func__', '__isabstractmethod__', '__get__', - '__dict__', '__doc__'} - - -def test_staticmethod(): - import abc - - - # test __init__ - def a(): - pass - - - assert isinstance(staticmethod(a), staticmethod) - - - # test __new__ - def b(): - pass - - - def c(): - pass - - - def d(): - pass - - - def e(): - pass - - - assert isinstance(staticmethod.__new__(staticmethod, b, c, d=d, e=e), staticmethod) - - - # test __func__ - def f(): - pass - - - assert staticmethod(f).__func__ == f - - - # test __isabstractmethod__ - @abc.abstractmethod - def g(): - pass - - - def h(): - pass - - - assert staticmethod(g).__isabstractmethod__ - assert not staticmethod(h).__isabstractmethod__ - - - # test __get__ - class WrappedWithSM: - @staticmethod - def foo(): - return 10 - - - class ReassignedWithSM: - def foo(): - return 10 - foo = staticmethod(foo) - - - assert type(WrappedWithSM.__dict__["foo"].__get__(WrappedWithSM, type)).__name__ == "function" - assert type(WrappedWithSM.__dict__["foo"].__get__(WrappedWithSM)).__name__ == "function" - assert type(ReassignedWithSM.__dict__["foo"].__get__(ReassignedWithSM, type)).__name__ == "function" - assert type(ReassignedWithSM.__dict__["foo"].__get__(ReassignedWithSM)).__name__ == "function" - - - # test __dict__.keys() - assert set(staticmethod.__dict__.keys()) == {'__init__', '__new__', '__func__', '__isabstractmethod__', '__get__', - '__dict__', '__doc__'} - - -def test_str_init_new(): - class A: - def __str__(self): - return "A" - - assert str.__new__(str) is not None - assert str.__new__(str, A()) is not None - assert str.__new__(str, b"foo") is not None - assert str.__new__(str, b"foo", "utf-8") is not None - assert str.__new__(str, b"foo", "utf-8", "strict") is not None - - assert str() is not None - assert str(A()) is not None - assert str(b"foo") is not None - assert str(b"foo", "utf-8") is not None - assert str(b"foo", "utf-8", "strict") is not None - - -def test_int_init_new(): - class A: - def __int__(self): - return 5 - - assert int.__new__(int) is not None - assert int.__new__(int, A()) is not None - assert int.__new__(int, u"100") is not None - assert int.__new__(int, b"100") is not None - assert int.__new__(int, u"100", 2) is not None - assert int.__new__(int, b"100", 2) is not None - - assert int() is not None - assert int(A()) is not None - assert int(u"100") is not None - assert int(b"100") is not None - assert int(u"100", 2) is not None - assert int(b"100", 2) is not None - - -def test_dict_update(): - d = {} - d.update({"k1": 1, "v1": 1}) - d.update([("k2", 2), ("v2", 2)]) - d.update(k3=3, v3=3) - assert d == {"k1": 1, "v1": 1, "k2": 2, "v2": 2, "k3": 3, "v3": 3} \ No newline at end of file diff --git a/python/testData/typeshed/stdlib/3/collections_test.py b/python/testData/typeshed/stdlib/3/collections_test.py deleted file mode 100644 index 0dfb516fd4ce..000000000000 --- a/python/testData/typeshed/stdlib/3/collections_test.py +++ /dev/null @@ -1,242 +0,0 @@ -def test_namedtuple(): - from collections import namedtuple - import sys - - if sys.version_info >= (3, 6): - assert namedtuple("Point", "x y", verbose=True, rename=True, module="m1")(1, 2).x == 1 - assert namedtuple(u"Point", u"x y", verbose=False, rename=False, module="m2")(1, 2).x == 1 - assert namedtuple(u"Point", u"x y", verbose=False, rename=False, module=None)(1, 2).x == 1 - - assert namedtuple("Point", ["x", "y"])(1, 2).x == 1 - assert namedtuple(u"Point", [u"x", u"y"])(1, 2).x == 1 - else: - assert namedtuple("Point", "x y", verbose=True, rename=True)(1, 2).x == 1 - assert namedtuple(u"Point", u"x y", verbose=False, rename=False)(1, 2).x == 1 - - assert namedtuple("Point", ["x", "y"], True, True)(1, 2).x == 1 - assert namedtuple(u"Point", [u"x", u"y"], False, False)(1, 2).x == 1 - - Point = namedtuple('Point', 'x y') - p = Point(1, 2) - - assert p == Point(1, 2) - - assert p._replace(y=3.14).y == 3.14 - assert p._asdict()['x'] == 1 - assert p._fields == ('x', 'y') - assert p._source is not None - - assert p == (1, 2) - assert (p.x, p.y) == (1, 2) - assert p[0] + p[1] == 3 - assert p.index(1) == 0 - - assert Point._make([1, 3.14]).y == 3.14 - - -def test_deque(): - from collections import deque - import sys - - d = deque([2]) - assert list(deque([1, 2, 3])) == [1, 2, 3] - assert list(deque([1, 2, 3], 2)) == [2, 3] - - assert deque([1, 2, 3]).maxlen is None - assert deque([1, 2, 3], 2).maxlen == 2 - - d.append(3) - d.appendleft(1) - assert list(d) == [1, 2, 3] - - d.clear() - assert len(d) == 0 - - if sys.version_info >= (3, 5): - copy = d.copy() - assert copy == d - assert copy is not d - - d.extend([1, 2, 3]) - d.extendleft([5, 3, 1]) - assert d.count(3) == 2 - assert list(d) == [1, 3, 5, 1, 2, 3] - - assert d.pop() == 3 - assert d.popleft() == 1 - d.remove(5) - assert list(d) == [3, 1, 2] - - d.reverse() - assert list(d) == [2, 1, 3] - d.rotate(1) - assert list(d) == [3, 2, 1] - d.rotate(-2) - assert list(d) == [1, 3, 2] - - assert len(d) == 3 - assert 3 in d - assert d[1] == 3 - d[1] = 4 - assert list(d) == [1, 4, 2] - - assert list(reversed(d)) == [2, 4, 1] - - if sys.version_info >= (3, 5): - d.insert(len(d), 4) - assert list(d) == [1, 4, 2, 4] - - assert d.index(4) == 1 - assert d.index(4, 2) == 3 - assert d.index(4, 2, len(d)) == 3 - - assert d + deque([5, 6]) == deque(list(d) + [5, 6]) - assert d * 2 == deque([1, 4, 2, 4, 1, 4, 2, 4]) - d *= 2 - assert list(d) == [1, 4, 2, 4, 1, 4, 2, 4] - - -def test_chain_map(): - from collections import ChainMap - - ChainMap() - cm = ChainMap({"a": 1, "b": 2}) - - assert cm.maps is not None - - assert cm.new_child().maps is not None - assert cm.new_child({"c": 3}).maps is not None - - assert cm.parents.maps is not None - - cm["d"] = 4 - del cm["a"] - assert cm["a"] is None - assert cm["b"] == 2 - assert cm["d"] == 4 - assert list(iter(cm)) == ["b", "d", "c"] - assert len(cm) == 3 - - -def test_counter(): - from collections import Counter - - c = Counter() - assert Counter("abc") == {"a": 1, "b": 1, "c": 1} - assert Counter({"a": 1, "b": 2, "c": 3}) == {"a": 1, "b": 2, "c": 3} - assert Counter(a=1, b=2, c=3) == {"a": 1, "b": 2, "c": 3} - - c["abc"] = 1 - c["def"] = 2 - assert c == {"abc": 1, "def": 2} - - c["def"] = 0 - assert c == {"abc": 1, "def": 0} - del c["def"] - - assert c["ghi"] == 0 - - c.update({"ghi": 2}) - assert list(c.elements()) == ["abc", "ghi", "ghi"] - - c.update(["a", "a", "b", "a", "a", "a", "b", "a"]) - assert c == {"abc": 1, "ghi": 2, "a": 6, "b": 2} - - c.update(a=-3, b=-1) - assert c == {"abc": 1, "ghi": 2, "a": 3, "b": 1} - - assert c.most_common(2) == [("a", 3), ("ghi", 2)] - assert c.most_common() == [("a", 3), ("ghi", 2), ("abc", 1), ("b", 1)] - c.subtract({"abc": 1, "ghi": -2, "a": 3, "b": -1}) - assert c == {"abc": 0, "ghi": 4, "a": 0, "b": 2} - - c = Counter(a=3, b=1) - d = Counter(a=1, b=2) - assert c + d == Counter({'a': 4, 'b': 3}) - assert c - d == Counter({'a': 2}) - assert c & d == Counter({'a': 1, 'b': 1}) - assert c | d == Counter({'a': 3, 'b': 2}) - - c = Counter(a=3, b=1) - c += d - assert c == Counter({'a': 4, 'b': 3}) - - c = Counter(a=3, b=1) - c -= d - assert c == Counter({'a': 2}) - - c = Counter(a=3, b=1) - c &= d - assert c == Counter({'a': 1, 'b': 1}) - - c = Counter(a=3, b=1) - c |= d - assert c == Counter({'a': 3, 'b': 2}) - - c = Counter(a=3, b=1) - c.subtract(["a", "b"]) - assert c == {"a": 2, "b": 0} - - c = Counter(a=2, b=-4) - assert +c == {"a": 2} - assert -c == {"b": 4} - - -def test_ordered_dict(): - from collections import OrderedDict - - od = OrderedDict([("a", 1), ("b", 2), ("c", 3), ("d", 4)]) - assert od.popitem() == ("d", 4) - assert od == OrderedDict([("a", 1), ("b", 2), ("c", 3)]) - assert od.popitem(last=False) == ("a", 1) - assert od == OrderedDict([("b", 2), ("c", 3)]) - assert od.popitem(last=True) == ("c", 3) - assert od == OrderedDict([("b", 2)]) - assert od == {"b": 2} - - od = OrderedDict([("a", 1), ("b", 2), ("c", 3)]) - od.move_to_end("a") - assert list(od.keys()) == ["b", "c", "a"] - od.move_to_end("c", last=True) - assert list(od.keys()) == ["b", "a", "c"] - od.move_to_end("a", last=False) - assert list(od.keys()) == ["a", "b", "c"] - - -def test_defaultdict(): - from collections import defaultdict - - assert defaultdict() == {} - assert defaultdict(k1=1, k2=2) == {"k1": 1, "k2": 2} - - assert defaultdict(lambda: 1) == {} - assert defaultdict(lambda: 2, {"k1": 1, "k2": 2}) == {"k1": 1, "k2": 2} - assert defaultdict(lambda: 3, [("k1", 1), ("k2", 2)]) == {"k1": 1, "k2": 2} - - assert defaultdict(None) == {} - assert defaultdict(None, {"k1": 1, "k2": 2}) == {"k1": 1, "k2": 2} - assert defaultdict(None, [("k1", 1), ("k2", 2)]) == {"k1": 1, "k2": 2} - - assert defaultdict(lambda: 4).__missing__("key") == 4 - - -def test_abc(): - from collections import (Container, Hashable, Iterable, Iterator, Reversible, Generator, Sized, Callable, - Collection, Sequence, MutableSequence, ByteString, Set, MutableSet, Mapping, - MutableMapping, MappingView, ItemsView, KeysView, ValuesView, Awaitable, Coroutine, - AsyncIterable, AsyncIterator, AsyncGenerator) - - assert [Container, Hashable, Iterable, Iterator, Reversible, Generator, Sized, Callable, - Collection, Sequence, MutableSequence, ByteString, Set, MutableSet, Mapping, - MutableMapping, MappingView, ItemsView, KeysView, ValuesView, Awaitable, Coroutine, - AsyncIterable, AsyncIterator, AsyncGenerator] - - from collections.abc import (Container, Hashable, Iterable, Iterator, Reversible, Generator, Sized, Callable, - Collection, Sequence, MutableSequence, ByteString, Set, MutableSet, Mapping, - MutableMapping, MappingView, ItemsView, KeysView, ValuesView, Awaitable, Coroutine, - AsyncIterable, AsyncIterator, AsyncGenerator) - - assert [Container, Hashable, Iterable, Iterator, Reversible, Generator, Sized, Callable, - Collection, Sequence, MutableSequence, ByteString, Set, MutableSet, Mapping, - MutableMapping, MappingView, ItemsView, KeysView, ValuesView, Awaitable, Coroutine, - AsyncIterable, AsyncIterator, AsyncGenerator] \ No newline at end of file diff --git a/python/testData/typeshed/stdlib/3/datetime_test.py b/python/testData/typeshed/stdlib/3/datetime_test.py deleted file mode 100644 index 0cae45534eee..000000000000 --- a/python/testData/typeshed/stdlib/3/datetime_test.py +++ /dev/null @@ -1,282 +0,0 @@ -def test_timezone(): - from datetime import datetime, timedelta, timezone - - tz_min = timezone(timedelta(minutes=-(60 * 24 - 1))) - tz_max = timezone(timedelta(minutes=60 * 24 - 1)) - - tz1 = timezone(timedelta(hours=2)) - dt1 = datetime(2000, 12, 15, 15, 16, 17, tzinfo=tz1) - - assert tz1.utc == timezone(timedelta()) - assert tz1.min == tz_min - assert tz1.max == tz_max - - assert tz1.tzname(dt1) == "UTC+02:00" - assert tz1.utcoffset(dt1) == timedelta(hours=2) - assert tz1.dst(dt1) is None - assert tz1.fromutc(dt1) == datetime(2000, 12, 15, 17, 16, 17, tzinfo=tz1) - - tz2 = timezone(timedelta(hours=-2), "NaMe") - dt2 = datetime(2000, 12, 15, 15, 16, 17, tzinfo=tz2) - - assert tz2.utc == timezone(timedelta()) - assert tz2.min == tz_min - assert tz2.max == tz_max - - assert tz2.tzname(None) == "NaMe" - assert tz2.utcoffset(None) == timedelta(hours=-2) - assert tz2.dst(None) is None - assert tz2.fromutc(dt2) == datetime(2000, 12, 15, 13, 16, 17, tzinfo=tz2) - - -def test_date(): - from datetime import date, timedelta - - d = date(2000, 12, 15) - - assert d.min == date(1, 1, 1) - assert d.max == date(9999, 12, 31) - assert d.resolution == timedelta(1) - - assert date.fromtimestamp(2048) == date(1970, 1, 1) - assert isinstance(date.today(), date) - assert date.fromordinal(2048) == date(6, 8, 10) - - assert d.year == 2000 - assert d.month == 12 - assert d.day == 15 - - assert d.ctime() == "Fri Dec 15 00:00:00 2000" - assert d.strftime("%d") == "15" - assert format(d, "%d") == "15" - assert d.isoformat() == "2000-12-15" - assert [d.timetuple()[i] for i in range(3)] == [2000, 12, 15] - assert d.toordinal() == 730469 - - assert d.replace() == date(2000, 12, 15) - assert d.replace(2001) == date(2001, d.month, d.day) - assert d.replace(2001, 11) == date(2001, 11, d.day) - assert d.replace(2001, 11, 16) == date(2001, 11, 16) - - assert d < date(2000, 12, 16) - assert d <= date(2000, 12, 15) - assert d > date(2000, 12, 14) - assert d >= date(2000, 12, 15) - - assert d + timedelta(3) == date(2000, 12, 18) - assert d - timedelta(3) == date(2000, 12, 12) - assert d - date(2000, 6, 8) == timedelta(190) - - assert d.weekday() == 4 - assert d.isoweekday() == 5 - assert d.isocalendar() == (2000, 50, 5) - - -def test_time(): - from datetime import time, timedelta - - time() - time(23) - - t1 = time(23, 25) - t = time(23, 25, 30) - t2 = time(23, 25, 30, 50) - - assert t.min == time() - assert t.max == time(23, 59, 59, 999999) - assert t.resolution == timedelta(microseconds=1) - - assert t.hour == 23 - assert t.minute == 25 - assert t.second == 30 - assert t.microsecond == 0 - assert t.tzinfo is None - - assert t < t2 - assert t <= time(23, 25, 30) - assert t > t1 - assert t >= time(23, 25, 30) - - assert t.isoformat() == "23:25:30" - assert t.strftime("%m") == "01" - assert format(t, "%m") == "01" - - assert t.utcoffset() is None - assert t.tzname() is None - assert t.dst() is None - - assert t.replace(22) == time(22, t.minute, t.second) - assert t.replace(22, 24) == time(22, 24, t.second) - assert t.replace(22, 24, 29) == time(22, 24, 29) - - from datetime import timezone - - t3 = time(23, 25, 20, tzinfo=None) - assert t3.tzinfo is None - t4 = t3.replace(tzinfo=timezone(timedelta(hours=2))) - assert t4.tzinfo == timezone(timedelta(hours=2)) - - t5 = time(23, 25, 20, tzinfo=timezone(timedelta(hours=2))) - assert t5.tzinfo == timezone(timedelta(hours=2)) - t6 = t5.replace(tzinfo=None) - assert t6.tzinfo is None - - -def test_timedelta(): - from datetime import timedelta - - timedelta() - timedelta(5) - timedelta(5, 6) - timedelta(5, 6, 7) - timedelta(5, 6, 7, 8) - timedelta(5, 6, 7, 8, 9) - timedelta(5, 6, 7, 8, 9, 10) - timedelta(5, 6, 7, 8, 9, 10, 11) - - td1 = timedelta(hours=1, minutes=10, seconds=10) - td = timedelta(hours=1, minutes=10, seconds=20) - td2 = timedelta(hours=1, minutes=10, seconds=30) - - assert td.min == timedelta(days=-999999999) - assert td.max == timedelta(days=999999999, hours=23, minutes=59, seconds=59, microseconds=999999) - assert td.resolution == timedelta(microseconds=1) - - assert td.days == 0 - assert td.seconds == 4220 - assert td.microseconds == 0 - - assert td.total_seconds() == 4220 - - assert td + td1 == timedelta(hours=2, minutes=20, seconds=30) - assert td2 - td == timedelta(seconds=10) - - assert -td == timedelta(days=-1, hours=22, minutes=49, seconds=40) - assert +td == td - - assert abs(td) == td - - assert td.__mul__(2) == timedelta(hours=2, minutes=20, seconds=40) - assert td.__rmul__(2) == timedelta(hours=2, minutes=20, seconds=40) - - assert td.__floordiv__(2) == timedelta(minutes=35, seconds=10) - assert td.__floordiv__(timedelta(minutes=5)) == 14 - - assert td.__truediv__(2) == timedelta(minutes=35, seconds=10) - td_result = td.__truediv__(timedelta(minutes=5)) - assert 14.0 < td_result - assert td_result < 14.1 - - assert td.__mod__(timedelta(minutes=5)) == timedelta(seconds=20) - assert td.__divmod__(timedelta(minutes=5)) == (14, timedelta(seconds=20)) - - assert td < td2 - assert td <= timedelta(hours=1, minutes=10, seconds=20) - assert td > td1 - assert td >= timedelta(hours=1, minutes=10, seconds=20) - - -def test_datetime(): - from datetime import datetime, timedelta, date, time - import sys - - datetime(2000, 12, 25) - datetime(2000, 12, 25, 23) - datetime(2000, 12, 25, 23, 59) - datetime(2000, 12, 25, 23, 59, 59) - datetime(2000, 12, 25, 23, 59, 59, 60) - dt1 = datetime(2000, 12, 24, 23, 59, 59) - dt = datetime(2000, 12, 25, 23, 59, 59) - dt2 = datetime(2000, 12, 26, 23, 59, 59) - - assert dt.min == datetime(1, 1, 1) - assert dt.max == datetime(9999, 12, 31, 23, 59, 59, 999999) - assert dt.resolution == timedelta(microseconds=1) - - assert dt.year == 2000 - assert dt.month == 12 - assert dt.day == 25 - assert dt.hour == 23 - assert dt.minute == 59 - assert dt.second == 59 - assert dt.microsecond == 0 - assert dt.tzinfo is None - - assert datetime.utcfromtimestamp(2048) == datetime(1970, 1, 1, 0, 34, 8) - assert isinstance(datetime.today(), datetime) - assert datetime.fromordinal(2048) == datetime(6, 8, 10) - assert isinstance(datetime.utcnow(), datetime) - assert datetime.combine(date(2000, 12, 25), time(23, 59, 59)) == dt - assert datetime.strptime("2000 12 25 23 59 59", "%Y %m %d %H %M %S") == dt - - assert dt.strftime("%Y %m %d %H %M %S") == "2000 12 25 23 59 59" - assert format(dt, "%Y %m %d %H %M %S") == "2000 12 25 23 59 59" - - assert dt.toordinal() == 730479 - assert [dt.timetuple()[i] for i in range(6)] == [2000, 12, 25, 23, 59, 59] - assert dt.timestamp() == 977777999.0 - assert [dt.utctimetuple()[i] for i in range(6)] == [2000, 12, 25, 23, 59, 59] - assert dt.date() == date(2000, 12, 25) - assert dt.time() == time(23, 59, 59) - assert dt.timetz() == time(23, 59, 59) - assert dt.ctime() == "Mon Dec 25 23:59:59 2000" - assert dt.isoformat() == "2000-12-25T23:59:59" - assert dt.isoformat(' ') == "2000-12-25 23:59:59" - assert dt.isoformat(sep=' ') == "2000-12-25 23:59:59" - if sys.version_info >= (3, 6): - assert dt.isoformat(' ', 'minutes') == "2000-12-25 23:59" - assert dt.isoformat(sep=' ', timespec='minutes') == "2000-12-25 23:59" - assert dt.utcoffset() is None - assert dt.tzname() is None - assert dt.dst() is None - assert dt.weekday() == 0 - assert dt.isoweekday() == 1 - assert dt.isocalendar() == (2000, 52, 1) - - assert dt.replace(2001) == datetime(2001, dt.month, dt.day, dt.hour, dt.minute, dt.second) - assert dt.replace(2001, 11) == datetime(2001, 11, dt.day, dt.hour, dt.minute, dt.second) - assert dt.replace(2001, 11, 24) == datetime(2001, 11, 24, dt.hour, dt.minute, dt.second) - assert dt.replace(2001, 11, 24, 22) == datetime(2001, 11, 24, 22, dt.minute, dt.second) - assert dt.replace(2001, 11, 24, 22, 58) == datetime(2001, 11, 24, 22, 58, dt.second) - assert dt.replace(2001, 11, 24, 22, 58, 58) == datetime(2001, 11, 24, 22, 58, 58) - - assert dt < dt2 - assert dt <= datetime(2000, 12, 25, 23, 59, 59) - assert dt > dt1 - assert dt >= datetime(2000, 12, 25, 23, 59, 59) - - assert dt + timedelta(3) == datetime(2000, 12, 28, 23, 59, 59) - assert dt - timedelta(3) == datetime(2000, 12, 22, 23, 59, 59) - assert dt - dt1 == timedelta(1) - - from datetime import timezone - - assert datetime.fromtimestamp(2048, timezone(timedelta(hours=2))) == datetime(1970, 1, 1, 2, 34, 8, tzinfo=timezone(timedelta(hours=2))) - assert datetime.fromtimestamp(2048, None) == datetime(1970, 1, 1, 3, 34, 8) - assert datetime.fromtimestamp(2048) == datetime(1970, 1, 1, 3, 34, 8) - - assert isinstance(datetime.now(timezone(timedelta(hours=2))), datetime) - assert isinstance(datetime.now(None), datetime) - assert isinstance(datetime.now(), datetime) - - dt3 = datetime(2000, 12, 25, 15, 16, 17, tzinfo=timezone(timedelta(hours=2))) - assert dt3.tzinfo == timezone(timedelta(hours=2)) - - assert dt3.astimezone(timezone(timedelta(hours=-2))) == datetime(2000, 12, 25, 11, 16, 17, tzinfo=timezone(timedelta(hours=-2))) - assert isinstance(dt3.astimezone(None), datetime) - assert isinstance(dt3.astimezone(), datetime) - - dt4 = dt3.replace(tzinfo=None) - assert dt4.tzinfo is None - - dt5 = datetime(2000, 12, 25, 15, 16, 17, tzinfo=None) - assert dt5.tzinfo is None - - import sys - if sys.version_info >= (3, 6): - assert dt5.astimezone(timezone(timedelta(hours=-2))) == datetime(2000, 12, 25, 10, 16, 17, tzinfo=timezone(timedelta(hours=-2))) - assert isinstance(dt5.astimezone(None), datetime) - assert isinstance(dt5.astimezone(), datetime) - - dt6 = dt5.replace(tzinfo=timezone(timedelta(hours=2))) - assert dt6.tzinfo == timezone(timedelta(hours=2)) \ No newline at end of file diff --git a/python/testData/typeshed/stdlib/3/os_test.py b/python/testData/typeshed/stdlib/3/os_test.py deleted file mode 100644 index d38c5d55e92c..000000000000 --- a/python/testData/typeshed/stdlib/3/os_test.py +++ /dev/null @@ -1,58 +0,0 @@ -def test_fsencode_path_like(): - import os - import sys - - assert os.fsencode("a.py") == b"a.py" - assert os.fsencode(b"a.py") == b"a.py" - - if sys.version_info >= (3, 6): - class A: - def __fspath__(self): - return "a.py" - - class B: - def __fspath__(self): - return b"a.py" - - assert os.fsencode(A()) == b"a.py" - assert os.fsencode(B()) == b"a.py" - - -def test_fsdecode_path_like(): - import os - import sys - - assert os.fsdecode("a.py") == "a.py" - assert os.fsdecode(b"a.py") == "a.py" - - if sys.version_info >= (3, 6): - class A: - def __fspath__(self): - return "a.py" - - class B: - def __fspath__(self): - return b"a.py" - - assert os.fsdecode(A()) == "a.py" - assert os.fsdecode(B()) == "a.py" - - -def test_fspath(): - import sys - - if sys.version_info >= (3, 6): - import os - - class A: - def __fspath__(self): - return "a.py" - - class B: - def __fspath__(self): - return b"a.py" - - assert os.fspath("a.py") == "a.py" - assert os.fspath(b"a.py") == b"a.py" - assert os.fspath(A()) == "a.py" - assert os.fspath(B()) == b"a.py" \ No newline at end of file diff --git a/python/testData/typeshed/stdlib/3/types_test.py b/python/testData/typeshed/stdlib/3/types_test.py deleted file mode 100644 index f86ce7a10d07..000000000000 --- a/python/testData/typeshed/stdlib/3/types_test.py +++ /dev/null @@ -1,10 +0,0 @@ -def test_methodtype(): - import types - - - class A: - def foo(self): - return "ok" - - - assert types.MethodType(A.foo, A())() == "ok" \ No newline at end of file diff --git a/python/testData/typeshed/stdlib/3/typing_test.py b/python/testData/typeshed/stdlib/3/typing_test.py deleted file mode 100644 index fb17d0e9fe71..000000000000 --- a/python/testData/typeshed/stdlib/3/typing_test.py +++ /dev/null @@ -1,12 +0,0 @@ -def test_namedtuple(): - from typing import NamedTuple - - nt1 = NamedTuple("nt1", [("x", str), ("y", int)]) - nt1_instance = nt1(x="str", y=5) - assert nt1_instance.x == "str" - assert nt1_instance.y == 5 - - nt2 = NamedTuple("nt2", x=str, y=int) - nt2_instance = nt2(x="str", y=5) - assert nt2_instance.x == "str" - assert nt2_instance.y == 5 \ No newline at end of file diff --git a/python/testData/typeshed/third_party/2and3/six_requirements.txt b/python/testData/typeshed/third_party/2and3/six_requirements.txt deleted file mode 100644 index b6e34eb294e6..000000000000 --- a/python/testData/typeshed/third_party/2and3/six_requirements.txt +++ /dev/null @@ -1 +0,0 @@ -six==1.10.0 diff --git a/python/testData/typeshed/third_party/2and3/six_test.py b/python/testData/typeshed/third_party/2and3/six_test.py deleted file mode 100644 index ab9898eb84b7..000000000000 --- a/python/testData/typeshed/third_party/2and3/six_test.py +++ /dev/null @@ -1,13 +0,0 @@ -def test_python_checks(): - from six import PY2, PY3 - - assert PY2 ^ PY3 - - -def test_xrange(): - from six.moves import xrange - - xs = xrange(5) - assert xs.__iter__ - assert xs[0] == 0 - assert sum(xs) == 10 diff --git a/python/testSrc/com/jetbrains/env/python/typeshed/PyTypeShedStubsTest.kt b/python/testSrc/com/jetbrains/env/python/typeshed/PyTypeShedStubsTest.kt deleted file mode 100644 index e75eb8a6fa25..000000000000 --- a/python/testSrc/com/jetbrains/env/python/typeshed/PyTypeShedStubsTest.kt +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.jetbrains.env.python.typeshed - -import com.intellij.testFramework.TestApplicationManager -import com.intellij.testFramework.runInEdtAndWait -import com.jetbrains.python.codeInsight.typing.PyTypeShed -import com.jetbrains.python.inspections.PyTypeCheckerInspection -import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection -import com.jetbrains.python.sdk.PythonSdkUtil -import junit.framework.TestCase -import org.junit.Test -import org.junit.runner.RunWith -import org.junit.runners.Parameterized -import java.io.File - -/** - * @author vlan - */ -@RunWith(Parameterized::class) -class PyTypeShedStubsTest(path: String, sdkPath: String) : PyTypeShedTestCase(path, sdkPath) { - @Test - fun test() { - runInEdtAndWait { - val typeShedPath = PyTypeShed.directoryPath ?: return@runInEdtAndWait - val importablePath = path.split("/").drop(2).joinToString("/") - fixture?.copyFileToProject("$typeShedPath/$path", importablePath) - fixture?.configureFromTempProjectFile(importablePath) - fixture?.enableInspections(PyUnresolvedReferencesInspection::class.java) - fixture?.enableInspections(PyTypeCheckerInspection::class.java) - fixture?.checkHighlighting(true, false, true) - val moduleSdk = PythonSdkUtil.findPythonSdk(fixture?.module) - TestCase.assertNotNull(moduleSdk) - } - } - - companion object { - @Parameterized.Parameters(name = "{0}: {1}") - @JvmStatic fun params(): List> { - TestApplicationManager.getInstance() - val typeShedPath = PyTypeShed.directoryPath ?: return emptyList() - val typeShedFile = File(typeShedPath) - return getSdkPaths() - .asSequence() - .flatMap { sdkPath -> - val level = getLanguageLevel(sdkPath) ?: return@flatMap emptySequence>() - PyTypeShed.findRootsForLanguageLevel(level).asSequence() - .flatMap { root: String -> - File("$typeShedPath/$root").walk() - .filter { it.isFile && it.extension == "pyi" && "third_party" !in it.absolutePath } - .map { arrayOf(it.relativeTo(typeShedFile).toString(), sdkPath) } - } - } - .toList() - } - } -} diff --git a/python/testSrc/com/jetbrains/env/python/typeshed/PyTypeShedTestCase.kt b/python/testSrc/com/jetbrains/env/python/typeshed/PyTypeShedTestCase.kt deleted file mode 100644 index c379a4ccd09b..000000000000 --- a/python/testSrc/com/jetbrains/env/python/typeshed/PyTypeShedTestCase.kt +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jetbrains.env.python.typeshed - -import com.intellij.openapi.project.Project -import com.intellij.openapi.projectRoots.Sdk -import com.intellij.openapi.projectRoots.impl.SdkConfigurationUtil -import com.intellij.openapi.roots.OrderRootType -import com.intellij.openapi.vfs.StandardFileSystems -import com.intellij.psi.stubs.StubUpdatingIndex -import com.intellij.testFramework.fixtures.CodeInsightTestFixture -import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl -import com.intellij.testFramework.runInEdtAndWait -import com.intellij.util.indexing.FileBasedIndex -import com.jetbrains.env.PyEnvTaskRunner -import com.jetbrains.env.PyEnvTestCase -import com.jetbrains.python.psi.LanguageLevel -import com.jetbrains.python.sdk.PythonSdkType -import com.jetbrains.python.sdk.PythonSdkUpdater -import com.jetbrains.python.sdk.PythonSdkUtil -import com.jetbrains.python.sdk.flavors.PythonSdkFlavor -import com.jetbrains.python.sdk.pythonSdk -import com.jetbrains.python.tools.sdkTools.PySdkTools -import org.junit.After -import org.junit.Before - -/** - * @author vlan - */ -abstract class PyTypeShedTestCase(protected val path: String, protected val sdkPath: String) : PyEnvTestCase() { - protected var fixture: CodeInsightTestFixture? = null - - @Before - fun initialize() { - val factory = IdeaTestFixtureFactory.getFixtureFactory() - val fixtureBuilder = factory.createLightFixtureBuilder() - fixture = factory.createCodeInsightFixture(fixtureBuilder.fixture, LightTempDirTestFixtureImpl(true)) - fixture?.testDataPath = "" // testDataPath is required to be not null - fixture?.setUp() - initSdk() - } - - private fun initSdk() { - val module = fixture?.module ?: return - val project = fixture?.project ?: return - val cachedSdk = sdkCache[sdkPath] - val newSdk = if (cachedSdk == null) createSdk(sdkPath, project) else null - val sdk = cachedSdk ?: newSdk ?: return - sdkCache[sdkPath] = sdk - val skeletonsDir = PythonSdkUtil.findSkeletonsDir(sdk) - if (skeletonsDir == null || skeletonsDir.children?.isEmpty() ?: true) { - PySdkTools.generateTempSkeletonsOrPackages(sdk, true, module) - } - runInEdtAndWait { - SdkConfigurationUtil.addSdk(sdk) - project.pythonSdk = sdk - module.pythonSdk = sdk - } - } - - private fun createSdk(sdkPath: String, project: Project): Sdk? { - val sdkFile = StandardFileSystems.local().findFileByPath(sdkPath) ?: return null - var sdkVar: Sdk? = null - runInEdtAndWait { - sdkVar = SdkConfigurationUtil.setupSdk(emptyArray(), sdkFile, PythonSdkType.getInstance(), true, null, null) - } - val sdk = sdkVar ?: return null - val modificator = sdk.sdkModificator - val paths = PythonSdkType.getSysPathsFromScript(sdk) - PythonSdkUpdater.filterRootPaths(sdk, paths, project).forEach { - modificator.addRoot(it, OrderRootType.CLASSES) - } - runInEdtAndWait { - modificator.commitChanges() - val index = FileBasedIndex.getInstance() - index.requestRebuild(StubUpdatingIndex.INDEX_ID) - } - return sdk - } - - @After - fun deInitialize() { - fixture?.tearDown() - } - - companion object { - private val sdkCache = mutableMapOf() - - internal fun getSdkPaths(): List { - val tags = setOf("typeshed") - return getDefaultPythonRoots() - .asSequence() - .filter { PyEnvTaskRunner.isSuitableForTags(loadEnvTags(it), tags) } - .map { PythonSdkUtil.getPythonExecutable(it) } - .filterNotNull() - .toList() - } - - internal fun getLanguageLevel(sdkPath: String): LanguageLevel? { - val flavor = PythonSdkFlavor.getFlavor(sdkPath) ?: return null - val versionString = flavor.getVersionString(sdkPath) ?: return null - return LanguageLevel.fromPythonVersion(versionString.removePrefix(flavor.name).trim()) - } - } -} diff --git a/python/testSrc/com/jetbrains/env/python/typeshed/PyTypeShedTestDataTest.kt b/python/testSrc/com/jetbrains/env/python/typeshed/PyTypeShedTestDataTest.kt deleted file mode 100644 index e2a3f4d916fa..000000000000 --- a/python/testSrc/com/jetbrains/env/python/typeshed/PyTypeShedTestDataTest.kt +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.jetbrains.env.python.typeshed - -import com.intellij.execution.configurations.GeneralCommandLine -import com.intellij.testFramework.PlatformTestUtil -import com.intellij.testFramework.TestApplicationManager -import com.intellij.testFramework.runInEdtAndWait -import com.jetbrains.python.codeInsight.typing.PyTypeShed -import com.jetbrains.python.inspections.PyTypeCheckerInspection -import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection -import com.jetbrains.python.sdk.PythonSdkUtil -import junit.framework.TestCase -import org.junit.Test -import org.junit.runner.RunWith -import org.junit.runners.Parameterized -import java.io.File -import java.io.InputStreamReader - -/** - * @author vlan - */ -@RunWith(Parameterized::class) -class PyTypeShedTestDataTest(path: String, sdkPath: String) : PyTypeShedTestCase(path, sdkPath) { - @Test - fun test() { - runInEdtAndWait { - val fullPath = "$testDataPath/$path" - runProcess(sdkPath, "-m", "pytest", fullPath) - val importablePath = path.split("/").drop(2).joinToString("/") - fixture?.copyFileToProject(fullPath, importablePath) - fixture?.configureFromTempProjectFile(importablePath) - fixture?.enableInspections(PyUnresolvedReferencesInspection::class.java) - fixture?.enableInspections(PyTypeCheckerInspection::class.java) - fixture?.checkHighlighting(true, false, true) - val moduleSdk = PythonSdkUtil.findPythonSdk(fixture?.module) - TestCase.assertNotNull(moduleSdk) - } - } - - private fun runProcess(vararg args: String) { - val process = GeneralCommandLine(args.asList()).createProcess() - process.waitFor() - val stderr = InputStreamReader(process.errorStream).readText() - val stdout = InputStreamReader(process.inputStream).readText() - TestCase.assertEquals(if (stderr.isEmpty()) stdout else stderr, 0, process.exitValue()) - } - - companion object { - @Parameterized.Parameters(name = "{0}: {1}") - @JvmStatic fun params(): List> { - TestApplicationManager.getInstance() - val testDataFile = File(testDataPath) - return getSdkPaths() - .asSequence() - .flatMap { sdkPath -> - val level = getLanguageLevel(sdkPath) ?: return@flatMap emptySequence>() - PyTypeShed.findRootsForLanguageLevel(level).asSequence() - .flatMap { root: String -> - File("$testDataPath/$root").walk() - .filter { it.isFile && it.path.matches(Regex(".*_test.py")) } - .map { arrayOf(it.relativeTo(testDataFile).toString(), sdkPath) } - } - } - .toList() - } - - private val testDataPath: String - get() = "${PlatformTestUtil.getCommunityPath()}/python/testData/typeshed" - } -} diff --git a/python/testSrc/com/jetbrains/python/Py3TypeTest.java b/python/testSrc/com/jetbrains/python/Py3TypeTest.java index a8684c777a6f..f351f33393c8 100644 --- a/python/testSrc/com/jetbrains/python/Py3TypeTest.java +++ b/python/testSrc/com/jetbrains/python/Py3TypeTest.java @@ -1128,13 +1128,13 @@ public class Py3TypeTest extends PyTestCase { // PY-13750 public void testBuiltinRound() { doTest("int", "expr = round(1)"); - doTest("Union[int, float]", "expr = round(1, 1)"); + doTest("int", "expr = round(1, 1)"); doTest("int", "expr = round(1.1)"); doTest("float", "expr = round(1.1, 1)"); doTest("int", "expr = round(True)"); - doTest("Union[int, float]", "expr = round(True, 1)"); + doTest("int", "expr = round(True, 1)"); } // PY-29665 diff --git a/python/testSrc/com/jetbrains/python/PyLineBreakpointTypeTest.kt b/python/testSrc/com/jetbrains/python/PyLineBreakpointTypeTest.kt index 6174e26b0193..14291512785e 100644 --- a/python/testSrc/com/jetbrains/python/PyLineBreakpointTypeTest.kt +++ b/python/testSrc/com/jetbrains/python/PyLineBreakpointTypeTest.kt @@ -38,7 +38,7 @@ class PyLineBreakpointTypeTest : PyTestCase() { // PY-16932 fun testPutAtPythonStub() { - val pythonFile = PyTypeShed.directory!!.findFileByRelativePath("stdlib/2/__builtin__.pyi") + val pythonFile = PyTypeShed.directory!!.findFileByRelativePath("stdlib/@python2/__builtin__.pyi") val line = 55 val document = FileDocumentManager.getInstance().getDocument(pythonFile!!) diff --git a/python/testSrc/com/jetbrains/python/PythonMockSdk.java b/python/testSrc/com/jetbrains/python/PythonMockSdk.java index 893e1fb1a752..2050401965f7 100644 --- a/python/testSrc/com/jetbrains/python/PythonMockSdk.java +++ b/python/testSrc/com/jetbrains/python/PythonMockSdk.java @@ -68,10 +68,7 @@ public final class PythonMockSdk { ContainerUtil.addIfNotNull(result, PyUserSkeletonsUtil.getUserSkeletonsDirectory()); - final var typeShedDir = PyTypeShed.INSTANCE.getDirectory(); - for (String path : PyTypeShed.INSTANCE.findRootsForLanguageLevel(level)) { - ContainerUtil.addIfNotNull(result, typeShedDir.findFileByRelativePath(path)); - } + result.addAll(PyTypeShed.INSTANCE.findRootsForLanguageLevel(level)); return result; } diff --git a/python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kts b/python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kts index aa28287c50eb..09e7a1a849b4 100644 --- a/python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kts +++ b/python/tools/src/com/jetbrains/python/tools/PyTypeShedSync.kts @@ -97,7 +97,7 @@ val blacklist = sequenceOf( "getopt", "getpass", "glob", - "google", + "protobuf", "grp", "gzip", "html", @@ -121,12 +121,12 @@ val blacklist = sequenceOf( "mimetools", "msvcrt", "mutex", - "mypy_extensions", + "mypy-extensions", "netrc", "nis", "nntplib", "nturl2path", - "openssl", + "openssl-python", "optparse", // deprecated "pickletools", "platform", // leads to broken tests but could be enabled @@ -139,8 +139,6 @@ val blacklist = sequenceOf( "pycurl", "pymssql", "pymysql", - "pynamodb", - "pyre_extensions", "pytz", "pyvmomi", "quopri", @@ -203,7 +201,8 @@ val blacklist = sequenceOf( "whichdb", "xdrlib", "xmlrpclib", - "yaml" + "xxlimited", // not available in runtime + "PyYAML" ).mapTo(hashSetOf()) { it.toLowerCase() } println("Cleaning") @@ -220,14 +219,15 @@ fun sync(repo: Path, bundled: Path) { val whiteList = setOf(".github", "scripts", "stdlib", + "stubs", "tests", - "third_party", ".flake8", ".gitignore", "CONTRIBUTING.md", "LICENSE", "pre-commit", "pyproject.toml", + "pyrightconfig.json", "README.md", "requirements-tests-py3.txt") @@ -250,8 +250,7 @@ fun cleanTopLevelPackages(typeshed: Path, blackList: Set) { val whiteList = hashSetOf() sequenceOf(typeshed) - .flatMap { sequenceOf(it.resolve("stdlib"), it.resolve("third_party")) } - .flatMap { Files.newDirectoryStream(it).asSequence() } + .flatMap { sequenceOf(it.resolve("stdlib"), it.resolve("stdlib/@python2"), it.resolve("stubs")) } .flatMap { Files.newDirectoryStream(it).asSequence() } .filter { val name = it.nameWithoutExtension().toLowerCase()